prechod na novy koncept, vytvorenie suboru trid starajucich sa o model
[sport-group.git] / application / controllers / ErrorController.php
bloba237ef4a0ed0ff2520b96e223acee17e3bd40482
1 <?php
2 // application/controllers/ErrorController.php
4 /**
5 * ErrorController
6 */
7 class ErrorController extends Zend_Controller_Action
8 {
9 /**
10 * errorAction() is the action that will be called by the "ErrorHandler"
11 * plugin. When an error/exception has been encountered
12 * in a ZF MVC application (assuming the ErrorHandler has not been disabled
13 * in your bootstrap) - the Errorhandler will set the next dispatchable
14 * action to come here. This is the "default" module, "error" controller,
15 * specifically, the "error" action. These options are configurable.
17 * @see http://framework.zend.com/manual/en/zend.controller.plugins.html
19 * @return void
21 public function errorAction()
23 // Ensure the default view suffix is used so we always return good
24 // content
25 $this->_helper->viewRenderer->setViewSuffix('phtml');
27 // Grab the error object from the request
28 $errors = $this->_getParam('error_handler');
30 // $errors will be an object set as a parameter of the request object,
31 // type is a property
32 switch ($errors->type) {
33 case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
34 case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION:
36 // 404 error -- controller or action not found
37 $this->getResponse()->setHttpResponseCode(404);
38 $this->view->message = 'Page not found';
39 break;
40 default:
41 // application error
42 $this->getResponse()->setHttpResponseCode(500);
43 $this->view->message = 'Application error';
44 break;
47 // pass the environment to the view script so we can conditionally
48 // display more/less information
49 $this->view->env = $this->getInvokeArg('env');
51 // pass the actual exception object to the view
52 $this->view->exception = $errors->exception;
54 // pass the request to the view
55 $this->view->request = $errors->request;