Overview

Namespaces

  • None
  • PHP

Classes

  • BasePresenter
  • CekarnaPresenter
  • ErrorPresenter
  • Model
  • NavstevaPresenter
  • PacientPresenter
  • SignPresenter

Functions

  • callback
  • dump
  • Overview
  • Namespace
  • Class
  • Tree
 1: <?php
 2: /**
 3:  * Tento soubor je součástí projektu ErNISTo z předmetu A6N33LI Lékařská informatika
 4:  * v 1. ročníku magisterského studia oboru Biomedicínského inženýrství     
 5:  */
 6: 
 7: use Nette\Diagnostics\Debugger,
 8:     Nette\Application as NA;
 9: 
10: /**
11:  * Error presenter, který má na starost vypisování chyb. Založen na sandboxu dodávaném v Nette frameworku.
12:  */
13: class ErrorPresenter extends BasePresenter
14: {
15: 
16:     /**
17:      * Vykreslí chybu
18:          * @param  Exception
19:      * @return void
20:      */
21:     public function renderDefault($exception)
22:     {
23:         if ($this->isAjax()) { // AJAX request? Just note this error in payload.
24:             $this->payload->error = TRUE;
25:             $this->terminate();
26: 
27:         } elseif ($exception instanceof NA\BadRequestException) {
28:             $code = $exception->getCode();
29:             // load template 403.latte or 404.latte or ... 4xx.latte
30:             $this->setView(in_array($code, array(403, 404, 405, 410, 500)) ? $code : '4xx');
31:             // log to access.log
32:             Debugger::log("HTTP code $code: {$exception->getMessage()} in {$exception->getFile()}:{$exception->getLine()}", 'access');
33: 
34:         } else {
35:             $this->setView('500'); // load template 500.latte
36:             Debugger::log($exception, Debugger::ERROR); // and log exception
37:         }
38:     }
39: 
40: }
41: 
ErNISTo API documentation generated by ApiGen 2.6.1