summaryrefslogtreecommitdiff
path: root/app/Controller/AppController.php
blob: 34b9c8ccae4c7643f654a870151ff75d05633bd9 (plain)
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
<?php

namespace Kanboard\Controller;

use Kanboard\Core\Base;

/**
 * Class AppController
 *
 * @package Kanboard\Controller
 * @author  Frederic Guillot
 */
class AppController extends Base
{
    /**
     * Forbidden page
     *
     * @access public
     * @param  bool   $withoutLayout
     * @param  string $message
     */
    public function accessForbidden($withoutLayout = false, $message = '')
    {
        if ($this->request->isAjax()) {
            $this->response->json(array('message' => $message ?: t('Access Forbidden')), 403);
        } else {
            $this->response->html($this->helper->layout->app('app/forbidden', array(
                'title' => t('Access Forbidden'),
                'no_layout' => $withoutLayout,
            )));
        }
    }

    /**
     * Page not found
     *
     * @access public
     * @param  boolean $withoutLayout
     */
    public function notFound($withoutLayout = false)
    {
        $this->response->html($this->helper->layout->app('app/notfound', array(
            'title' => t('Page not found'),
            'no_layout' => $withoutLayout,
        )));
    }
}