forked from ProcessMaker/processmaker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApplication.php
More file actions
79 lines (68 loc) · 2.55 KB
/
Application.php
File metadata and controls
79 lines (68 loc) · 2.55 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
69
70
71
72
73
74
75
76
77
78
79
<?php
namespace ProcessMaker;
use Igaster\LaravelTheme\Facades\Theme;
use Illuminate\Foundation\Application as IlluminateApplication;
use Illuminate\Support\Facades\Auth;
/**
* Class Application
* @package ProcessMaker
*
* This represents our top level processmaker application.
*/
class Application extends IlluminateApplication
{
// Our ProcessMaker Version
const VERSION = '4.0.0';
/**
* Sets the timezone for the application and for php with the specified timezone
* @param $tz string The timezone to set to
*/
public function setTimezone($tz)
{
config(['app.timezone' => $tz]);
date_default_timezone_set(config('app.timezone'));
}
/**
* Retrieves the currently set timezone
* @return string The timezone for the system
*/
public function getTimezone()
{
return config('app.timezone');
}
/**
* Return the System defined constants and Application variables
* Constants: SYS_*
* Sessions : USER_* , URS_*
*
* @note: This is ported from Gulliver System. This will most likely need to be refactored/removed
* @return array Contents of system contents.
*/
public function getSystemConstants()
{
$sysCon = [];
$sysCon['SYS_LANG'] = $this->getLocale();
// Get the current theme
$sysCon['SYS_SKIN'] = Theme::get();
// The following items should be refactored to no longer use $_SESSION
// Since these items should be request scope specific and not session specific
$sysCon["APPLICATION"] = (isset($_SESSION["APPLICATION"]))? $_SESSION["APPLICATION"] : "";
$sysCon["PROCESS"] = (isset($_SESSION["PROCESS"]))? $_SESSION["PROCESS"] : "";
$sysCon["TASK"] = (isset($_SESSION["TASK"]))? $_SESSION["TASK"] : "";
$sysCon["INDEX"] = (isset($_SESSION["INDEX"]))? $_SESSION["INDEX"] : "";
$sysCon['USER_LOGGED'] = Auth::user() ? Auth::user()->USR_UID : '';
$sysCon['USER_USERNAME'] = Auth::user() ? Auth::user()->USR_USERNAME : '';
return $sysCon;
}
/**
* Get the path to the application "app" directory.
*
* @note This extends the base Application to specify ProcessMaker instead of app as the main directory
* @param string $path Optionally, a path to append to the app path
* @return string
*/
public function path($path = '')
{
return $this->basePath.DIRECTORY_SEPARATOR.'ProcessMaker'.($path ? DIRECTORY_SEPARATOR.$path : $path);
}
}