From 54b357b7019696be26cc369e317bc3ac6ba0a5de Mon Sep 17 00:00:00 2001 From: Li Jianxuan Date: Mon, 11 Jun 2012 01:44:10 +0000 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E6=8E=A7=E5=88=B6=E5=99=A8=EF=BC=8C=E4=BD=BF=E7=94=A8Layout?= =?UTF-8?q?=E6=8E=A7=E5=88=B6=E9=94=99=E8=AF=AF=E6=98=BE=E7=A4=BA=E3=80=81?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=86=E6=9D=83=E9=99=90=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../default/controllers/ErrorController.php | 40 ++++++++++++------- .../views/scripts/error/authority.phtml | 14 +++++++ .../default/views/scripts/error/error.phtml | 17 +++++++- 3 files changed, 55 insertions(+), 16 deletions(-) create mode 100644 application/default/views/scripts/error/authority.phtml diff --git a/application/default/controllers/ErrorController.php b/application/default/controllers/ErrorController.php index b6baaae3..e950693c 100755 --- a/application/default/controllers/ErrorController.php +++ b/application/default/controllers/ErrorController.php @@ -2,33 +2,45 @@ class ErrorController extends Zend_Controller_Action { + function preDispatch() + { + $this->view->config = Zend_Registry::get('config'); + $this->db=Zend_Registry::get('db'); + } + public function errorAction() { $errors = $this->_getParam('error_handler'); - + switch ($errors->type) { - case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER: - case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION: + + case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER: + + case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION: + // 404 error -- controller or action not found $this->getResponse()->setRawHeader('HTTP/1.1 404 Not Found'); - - $content =<<Error! -

The page you requested was not found.

-EOH; + $title = "您所访问的页面未找到"; + $content = '您所访问的页面未找到
+ The page you requested was not found.'; break; - default: + + default: // application error - $content =<<Error! -

An unexpected error occurred. Please try again later.

-EOH; + $title = "服务器内部错误"; + $content = '服务器开了小差,请稍后再试或联系管理员
+ An unexpected error occurred. Please try again later.'; break; } // Clear previous content $this->getResponse()->clearBody(); - + + $this->view->title = $title; $this->view->content = $content; } + + public function authorityAction(){ + + } } \ No newline at end of file diff --git a/application/default/views/scripts/error/authority.phtml b/application/default/views/scripts/error/authority.phtml new file mode 100644 index 00000000..d0733e3e --- /dev/null +++ b/application/default/views/scripts/error/authority.phtml @@ -0,0 +1,14 @@ +headTitle($this->config->title->site); + $this->headTitle()->setSeparator(' - '); + $this->headTitle('权限错误'); +?> +
+
+

您没有权限进行此操作

+
+

+ 您所在的用户组没有进行此操作的权限,如过需要获取该权限需要联系管理员 +

+
+
diff --git a/application/default/views/scripts/error/error.phtml b/application/default/views/scripts/error/error.phtml index f1e05ab2..343d6c69 100755 --- a/application/default/views/scripts/error/error.phtml +++ b/application/default/views/scripts/error/error.phtml @@ -1,3 +1,16 @@ content; -?> \ No newline at end of file + $this->headTitle($this->config->title->site); + $this->headTitle()->setSeparator(' - '); + $this->headTitle($this->title); +?> +
+
+

错误提示 - 服务器错误

+
+

+ content; + ?> +

+
+
\ No newline at end of file