summaryrefslogtreecommitdiff
path: root/app/Helper/App.php
blob: 8f59114394d7ebe22f2ae2bed25d335713b59ccf (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
48
49
50
51
52
53
54
55
56
<?php

namespace Helper;

/**
 * Application helpers
 *
 * @package helper
 * @author  Frederic Guillot
 */
class App extends \Core\Base
{
    /**
     * Get javascript language code
     *
     * @access public
     * @return string
     */
    public function jsLang()
    {
        return $this->config->getJsLanguageCode();
    }

    /**
     * Get current timezone
     *
     * @access public
     * @return string
     */
    public function getTimezone()
    {
        return $this->config->getCurrentTimezone();
    }

    /**
     * Get session flash message
     *
     * @access public
     * @return string
     */
    public function flashMessage()
    {
        $html = '';

        if (isset($this->session['flash_message'])) {
            $html = '<div class="alert alert-success alert-fade-out">'.$this->helper->e($this->session['flash_message']).'</div>';
            unset($this->session['flash_message']);
        }
        else if (isset($this->session['flash_error_message'])) {
            $html = '<div class="alert alert-error">'.$this->helper->e($this->session['flash_error_message']).'</div>';
            unset($this->session['flash_error_message']);
        }

        return $html;
    }
}