Next4Me
 All Data Structures Files Functions
application/controllers/ErrorController.php
00001 <?php
00002 
00003 class ErrorController extends Zend_Controller_Action{
00004 
00005     public function errorAction(){
00006 
00007         $errors = $this->_getParam('error_handler');
00008         
00009         if (!$errors) {
00010             $this->view->message = 'You have reached the error page';
00011             return;
00012         }
00013         
00014         switch ($errors->type) {
00015             case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ROUTE:
00016             case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
00017             case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION:
00018         
00019                 // 404 error -- controller or action not found
00020                 $this->getResponse()->setHttpResponseCode(404);
00021                 $this->view->message = 'Pagina inexistenta';
00022                 break;
00023             default:
00024                 // application error
00025                 $this->getResponse()->setHttpResponseCode(500);
00026                 $this->view->message = 'Eroare de aplicatie';
00027                 break;
00028         }
00029                 
00030         // conditionally display exceptions
00031         if ($this->getInvokeArg('displayExceptions') == true) $this->view->exception = $errors->exception;
00032         
00033         $this->view->request   = $errors->request;
00034         
00035         if(APPLICATION_ENV == "production") $this->render("404");
00036     
00037     }
00038 
00039 }
00040