forked from exodus4d/pathfinder
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmapcontroller.php
More file actions
68 lines (50 loc) · 1.47 KB
/
Copy pathmapcontroller.php
File metadata and controls
68 lines (50 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?php
/**
* Created by PhpStorm.
* User: exodus4d
* Date: 08.02.15
* Time: 21:18
*/
namespace Controller;
class MapController extends \Controller\AccessController {
function __construct() {
parent::__construct();
}
public function showMap($f3) {
$f3->set('pageContent', false);
// body element class
$this->f3->set('bodyClass', 'pf-body');
// set trust attribute to template
$this->f3->set('trusted', (int)self::isIGBTrusted());
// JS main file
$this->f3->set('jsView', 'mappage');
$this->setTemplate('templates/view/index.html');
}
/**
* function is called on each error
* @param $f3
*/
public function showError($f3){
// set HTTP status
if(!empty($f3->get('ERROR.code'))){
$f3->status($f3->get('ERROR.code'));
}
if($f3->get('AJAX')){
header('Content-type: application/json');
// error on ajax call
$errorData = [
'status' => $f3->get('ERROR.status'),
'code' => $f3->get('ERROR.code'),
'text' => $f3->get('ERROR.text')
];
// append stack trace for greater debug level
if( $f3->get('DEBUG') === 3){
$errorData['trace'] = $f3->get('ERROR.trace');
}
echo json_encode($errorData);
}else{
echo $f3->get('ERROR.text');
}
die();
}
}