/** * アプリケーションの基底URIを取得します。 */ public static function getBasePath() { $base = str_replace("/teeple_controller.php", "", Teeple_Util::getScriptName()); return $base; }
/** * Viewの処理を実行 * **/ public function postfilter() { if ($this->isCompleteResponse()) { $this->log->info("CompleteResponseフラグが立っているため、Viewは実行されませんでした。"); return; } $view = $this->response->getView(); $this->log->debug("view: {$view}"); if ($view == "") { $view = Teeple_Util::getPathInfo(); } if ($view != "") { $template = preg_replace("/^\\//", "", $view); if ($template == "") { throw new Teeple_Exception("テンプレートの指定が不正です。({$template})"); } if (preg_match("/^location:/", $template)) { $url = preg_replace("/^location:/", "", $template); $url = trim($url); $this->response->setRedirect($url); } else { if (preg_match("/^redirect:/", $template)) { $url = preg_replace("/^redirect:/", "", $template); $url = trim($url); $url = Teeple_Util::getAbsoluteUrlFromActionName($url, $this->request->isHttps()); $this->request->setFilterError(NULL); // TODO 定数化 $this->session->setParameter("__REDIRECT_SCOPE_REQUEST", $this->request); $this->response->setRedirect($url); } else { $renderer = Teeple_Smarty4Maple::getInstance(); $action = $this->actionChain->getCurAction(); $renderer->setAction($action); if (is_object($this->token)) { $renderer->setToken($this->token); } if (is_object($this->session)) { $renderer->setSession($this->session); } if (is_object($this->request)) { $renderer->setRequest($this->request); } $renderer->setScriptName(Teeple_Util::getScriptName()); $result = $renderer->fetch($template); if ($result == "") { throw new Teeple_Exception("Viewのレンダリングに失敗しました。"); } $this->response->setResult($result); } } } $contentDisposition = $this->response->getContentDisposition(); $contentType = $this->response->getContentType(); $result = $this->response->getResult(); $redirect = $this->response->getRedirect(); if ($redirect) { $this->redirect($redirect); } else { if ($contentDisposition != "") { header("Content-disposition: {$contentDisposition}"); } if ($contentType != "") { header("Content-type: {$contentType}"); } print $result; } return; }