public function invoke(User $user, $handlerName) { $user->validate(); include_once RUDRA . "/core/handler/AbstractHandler.php"; $handleCache = new RxCache("handlers", true); global $temp; $className; if ($handleCache->hasKey($handlerName)) { $classObj = $handleCache->get($handlerName); include_once $classObj["filePath"]; $className = $classObj["className"]; } else { $className = ucfirst($handlerName); include_once HANDLER_PATH . "/" . $this->getHandlerPath() . $className . ".php"; } $tempClass = new ReflectionClass($className); if ($tempClass->isInstantiable()) { $temp = $tempClass->newInstance(); } if ($temp != NULL) { if ($tempClass->hasMethod("invokeHandler")) { $tpl = new Smarty(); // $tpl->prepare(); self::setSmartyPaths($tpl); // $tpl->testInstall(); exit; $tpl->debugging = Config::get('SMARTY_DEBUG'); $page = new Page(); $view = RudraX::invokeMethodByReflectionClass($tempClass, $temp, 'invokeHandler', array('tpl' => $tpl, 'viewModel' => $tpl, 'user' => $user, 'page' => $page, 'dataModel' => $page->data)); //$view = $temp->invokeHandler($tpl ); if (!isset($view)) { $view = $handlerName; } $tpl->assign('user', $user); $tpl->assign('CONTEXT_PATH', CONTEXT_PATH); $tpl->assign('RESOURCE_PATH', Config::get('RESOURCE_PATH')); if (isset($tpl->repeatData)) { foreach ($tpl->repeatData as $key => $value) { $tpl->assign($value['key'], $value['value']); $tpl->display($this->getViewPath() . $view . Config::get('TEMP_EXT')); } } else { $tpl->display($this->getViewPath() . $view . Config::get('TEMP_EXT')); } echo TEMP_DELIMITER; if (BROWSER_LOGS) { Browser::printlogs(); } echo TEMP_DELIMITER . json_encode($page->data->data); } else { if ($tempClass->hasMethod("invoke")) { $view = $temp->invoke(); if (!isset($view)) { $view = $handlerName; } include $this->getViewPath() . $view . '.php'; } } } }
function rx_interceptor_page($user, $info, $handlerName) { $user->validate(); include_once RUDRA . "/core/handler/AbstractHandler.php"; $handlerInfo = ClassUtil::getHandler($handlerName); if ($handlerInfo != NULL) { global $temp; include_once $handlerInfo["filePath"]; $className = $handlerInfo["className"]; $tempClass = new ReflectionClass($className); if ($tempClass->isInstantiable()) { $temp = $tempClass->newInstance(); } if ($temp != NULL) { if ($tempClass->hasMethod("invokeHandler")) { $tpl = new Smarty(); call_user_func(rx_function("rx_set_smarty_paths"), $tpl); $tpl->debugging = RX_SMARTY_DEBUG; $header = new Header($tpl); $page = new Page(); $view = call_method_by_class($tempClass, $temp, 'invokeHandler', array('tpl' => $tpl, 'viewModel' => $tpl, 'user' => $user, 'header' => $header, 'page' => $page, 'dataModel' => $page->data, 'data' => new RequestData(get_request_param("data"))), $handlerInfo["requestParams"]); if (!isset($view)) { $view = $handlerName; } $tpl->assign('user', $user); $tpl->assign('page', $page); $tpl->assign('header', $header); $tpl->assign('CONTEXT_PATH', CONTEXT_PATH); $tpl->assign('RESOURCE_PATH', RESOURCE_PATH); $tpl->assign('METAS', $header->metas); $tpl->assign('TITLE', $header->title); $view_path = $view . TEMP_EXT; if (!file_exists($view_path)) { $tpl->setTemplateDir(RUDRA . "/core/view"); //$view_path = get_include_path () . RUDRA . "/core/view/".$view.TEMP_EXT; //$view_path = get_include_path () . RUDRA . "../view/".$view.TEMP_EXT; } $tpl->assign('BODY_FILES', $view_path); $tpl->assign('page_json', json_encode($page->data->data)); $tpl->display(RUDRA . "/core/view/full.tpl"); Browser::log("header", $header->css, $header->scripts); Browser::printlogs(); } } } }
function rx_interceptor_template($user, $info, $handlerName) { $user->validate(); include_once RUDRA . "/core/handler/AbstractHandler.php"; $handlerInfo = ClassUtil::getHandler($handlerName); if ($handlerInfo != NULL) { global $temp; include_once $handlerInfo["filePath"]; $className = $handlerInfo["className"]; $tempClass = new ReflectionClass($className); if ($tempClass->isInstantiable()) { $temp = $tempClass->newInstance(); } if ($temp != NULL) { if ($tempClass->hasMethod("invokeHandler")) { $tpl = new Smarty(); call_user_func(rx_function("rx_set_smarty_paths"), $tpl); $tpl->debugging = RX_SMARTY_DEBUG; $page = new Page(); $view = call_method_by_class($tempClass, $temp, 'invokeHandler', array('tpl' => $tpl, 'viewModel' => $tpl, 'user' => $user, 'page' => $page, 'dataModel' => $page->data, 'data' => new RequestData(get_request_param("data"))), $handlerInfo["requestParams"]); if (!isset($view)) { $view = $handlerName; } $tpl->assign('user', $user); $tpl->assign('CONTEXT_PATH', CONTEXT_PATH); $tpl->assign('RESOURCE_PATH', RESOURCE_PATH); if (isset($tpl->repeatData)) { foreach ($tpl->repeatData as $key => $value) { $tpl->assign($value['key'], $value['value']); $tpl->display($this->getViewPath() . $view . Config::get('TEMP_EXT')); } } else { $tpl->display($this->getViewPath() . $view . Config::get('TEMP_EXT')); } echo TEMP_DELIMITER; Browser::printlogs(); echo TEMP_DELIMITER . json_encode($page->data->data); Browser::printlogs(); } } } }
function rx_interceptor_page($user, $controllerInfo, $params, $controllerExecute) { ?> <html> <? $tpl = new Smarty (); $params["model"] = $tpl; $header = new \app\model\Header ($tpl); call_user_func(rx_function("rx_set_smarty_paths"), ($tpl)); $view = $controllerExecute($params); $tpl->debugging = RX_SMARTY_DEBUG; $tpl->assign('user', $user); $tpl->assign('header', $header); $tpl->assign('CONTEXT_PATH', CONTEXT_PATH); $tpl->assign('METAS', $header->metas); $tpl->assign('TITLE', $header->title); ?> <head></head> <body> <? $tpl->display($view_path = $view . TEMP_EXT); ?></body><? Browser::log("header", $header->css, $header->scripts); Browser::printlogs(); ?></html><? }