@@ -11,64 +11,64 @@ |
||
11 | 11 | |
12 | 12 | class Controller extends BaseController |
13 | 13 | { |
14 | - public function index() |
|
15 | - { |
|
16 | - return SystemCore::isInstalled()? redirect('home'): redirect('install'); |
|
17 | - } |
|
14 | + public function index() |
|
15 | + { |
|
16 | + return SystemCore::isInstalled()? redirect('home'): redirect('install'); |
|
17 | + } |
|
18 | 18 | |
19 | - public function install(UI $ui) |
|
20 | - { |
|
21 | - // make sure the installation information is fresh |
|
22 | - ModuleManager::clearCache(); |
|
19 | + public function install(UI $ui) |
|
20 | + { |
|
21 | + // make sure the installation information is fresh |
|
22 | + ModuleManager::clearCache(); |
|
23 | 23 | |
24 | - if (SystemCore::isInstalled()) return redirect('home'); |
|
24 | + if (SystemCore::isInstalled()) return redirect('home'); |
|
25 | 25 | |
26 | - $ui->title = __(':epesi > Installation', ['epesi' => config('epesi.ui.title')]); |
|
26 | + $ui->title = __(':epesi > Installation', ['epesi' => config('epesi.ui.title')]); |
|
27 | 27 | |
28 | - $ui->initLayout(new Layout\Centered()); |
|
28 | + $ui->initLayout(new Layout\Centered()); |
|
29 | 29 | |
30 | - $ui->layout->set('logo', url('logo')); |
|
31 | - $ui->layout->template->dangerouslySetHTML('copyright', config('epesi.ui.copyright')); |
|
30 | + $ui->layout->set('logo', url('logo')); |
|
31 | + $ui->layout->template->dangerouslySetHTML('copyright', config('epesi.ui.copyright')); |
|
32 | 32 | |
33 | - $ui->add(new \Epesi\Core\System\SystemInstallWizard()); |
|
33 | + $ui->add(new \Epesi\Core\System\SystemInstallWizard()); |
|
34 | 34 | |
35 | - return $ui->response(); |
|
36 | - } |
|
35 | + return $ui->response(); |
|
36 | + } |
|
37 | 37 | |
38 | - public function home() |
|
39 | - { |
|
40 | - return redirect(SystemCore::isInstalled()? HomePage\Model\HomePage::pathOfUser(): 'install'); |
|
41 | - } |
|
38 | + public function home() |
|
39 | + { |
|
40 | + return redirect(SystemCore::isInstalled()? HomePage\Model\HomePage::pathOfUser(): 'install'); |
|
41 | + } |
|
42 | 42 | |
43 | - public function logo() |
|
44 | - { |
|
45 | - $logoFile = \Epesi\Core\System\Logo\LogoSettings::getLogoFile(); |
|
43 | + public function logo() |
|
44 | + { |
|
45 | + $logoFile = \Epesi\Core\System\Logo\LogoSettings::getLogoFile(); |
|
46 | 46 | |
47 | - return response(File::get($logoFile), 200, ['Content-type' => File::mimeType($logoFile)])->setMaxAge(604800)->setPublic(); |
|
48 | - } |
|
47 | + return response(File::get($logoFile), 200, ['Content-type' => File::mimeType($logoFile)])->setMaxAge(604800)->setPublic(); |
|
48 | + } |
|
49 | 49 | |
50 | - public function view(UI $ui, $module, $method = 'body', $args = []) |
|
51 | - { |
|
52 | - $ui->initLayout(new LayoutView()); |
|
50 | + public function view(UI $ui, $module, $method = 'body', $args = []) |
|
51 | + { |
|
52 | + $ui->initLayout(new LayoutView()); |
|
53 | 53 | |
54 | - $alias = explode(':', $module); |
|
54 | + $alias = explode(':', $module); |
|
55 | 55 | |
56 | - $moduleAlias = $alias[0]; |
|
57 | - $viewAlias = $alias[1]?? null; |
|
56 | + $moduleAlias = $alias[0]; |
|
57 | + $viewAlias = $alias[1]?? null; |
|
58 | 58 | |
59 | - $view = null; |
|
60 | - if ($module = ModuleManager::getClass($moduleAlias, true)) { |
|
61 | - $viewClass = $module::view($viewAlias); |
|
59 | + $view = null; |
|
60 | + if ($module = ModuleManager::getClass($moduleAlias, true)) { |
|
61 | + $viewClass = $module::view($viewAlias); |
|
62 | 62 | |
63 | - if (class_exists($viewClass)) { |
|
64 | - $view = [$viewClass]; |
|
65 | - } |
|
66 | - } |
|
63 | + if (class_exists($viewClass)) { |
|
64 | + $view = [$viewClass]; |
|
65 | + } |
|
66 | + } |
|
67 | 67 | |
68 | - if (! $view) abort(404); |
|
68 | + if (! $view) abort(404); |
|
69 | 69 | |
70 | - $location = $ui->add($view)->displayModuleContent($method, $args)->location(); |
|
70 | + $location = $ui->add($view)->displayModuleContent($method, $args)->location(); |
|
71 | 71 | |
72 | - return $ui->setLocation($location)->response(); |
|
73 | - } |
|
72 | + return $ui->setLocation($location)->response(); |
|
73 | + } |
|
74 | 74 | } |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | { |
14 | 14 | public function index() |
15 | 15 | { |
16 | - return SystemCore::isInstalled()? redirect('home'): redirect('install'); |
|
16 | + return SystemCore::isInstalled() ? redirect('home') : redirect('install'); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | public function install(UI $ui) |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | |
38 | 38 | public function home() |
39 | 39 | { |
40 | - return redirect(SystemCore::isInstalled()? HomePage\Model\HomePage::pathOfUser(): 'install'); |
|
40 | + return redirect(SystemCore::isInstalled() ? HomePage\Model\HomePage::pathOfUser() : 'install'); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | public function logo() |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | $alias = explode(':', $module); |
55 | 55 | |
56 | 56 | $moduleAlias = $alias[0]; |
57 | - $viewAlias = $alias[1]?? null; |
|
57 | + $viewAlias = $alias[1] ?? null; |
|
58 | 58 | |
59 | 59 | $view = null; |
60 | 60 | if ($module = ModuleManager::getClass($moduleAlias, true)) { |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | } |
66 | 66 | } |
67 | 67 | |
68 | - if (! $view) abort(404); |
|
68 | + if (!$view) abort(404); |
|
69 | 69 | |
70 | 70 | $location = $ui->add($view)->displayModuleContent($method, $args)->location(); |
71 | 71 |
@@ -25,10 +25,10 @@ discard block |
||
25 | 25 | { |
26 | 26 | parent::__construct([ |
27 | 27 | 'title' => config('epesi.ui.title', 'EPESI'), |
28 | - 'cdn' => array_merge($this->cdn, (array) config('epesi.ui.cdn')), |
|
28 | + 'cdn' => array_merge($this->cdn, (array) config('epesi.ui.cdn')), |
|
29 | 29 | //TODO: set the skin from admin / user selection |
30 | - 'skin' => config('epesi.ui.skin', $this->skin), |
|
31 | - 'template_dir' => array_merge(ModuleManager::collect('templates', $this->skin), (array) $this->template_dir), |
|
30 | + 'skin' => config('epesi.ui.skin', $this->skin), |
|
31 | + 'template_dir' => array_merge(ModuleManager::collect('templates', $this->skin), (array) $this->template_dir), |
|
32 | 32 | // 'catch_error_types' => config('app.debug') ? |
33 | 33 | // // debug mode |
34 | 34 | // E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_USER_DEPRECATED : |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | |
40 | 40 | final public static function module() |
41 | 41 | { |
42 | - return System\SystemCore::class; |
|
42 | + return System\SystemCore::class; |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | public function response() |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | |
59 | 59 | public function render() |
60 | 60 | { |
61 | - System\SystemCore::requireCSS('epesi.css'); |
|
61 | + System\SystemCore::requireCSS('epesi.css'); |
|
62 | 62 | |
63 | 63 | $this->addCsrfToken(); |
64 | 64 | |
@@ -81,18 +81,18 @@ discard block |
||
81 | 81 | */ |
82 | 82 | public function renderException($exception) |
83 | 83 | { |
84 | - ob_start(); |
|
85 | - if ($exception instanceof TokenMismatchException) { |
|
86 | - $this->jsRedirectHomepage(__('Session expired! Redirecting to login screen ...')); |
|
87 | - } |
|
88 | - elseif ($exception instanceof NotFoundHttpException) { |
|
89 | - $this->jsRedirectHomepage(__('Requested page not found! Redirecting to your home page ...')); |
|
90 | - } |
|
91 | - else { |
|
92 | - $this->caughtException($exception); |
|
93 | - } |
|
84 | + ob_start(); |
|
85 | + if ($exception instanceof TokenMismatchException) { |
|
86 | + $this->jsRedirectHomepage(__('Session expired! Redirecting to login screen ...')); |
|
87 | + } |
|
88 | + elseif ($exception instanceof NotFoundHttpException) { |
|
89 | + $this->jsRedirectHomepage(__('Requested page not found! Redirecting to your home page ...')); |
|
90 | + } |
|
91 | + else { |
|
92 | + $this->caughtException($exception); |
|
93 | + } |
|
94 | 94 | |
95 | - return ob_get_clean(); |
|
95 | + return ob_get_clean(); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | /** |
@@ -102,20 +102,20 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public function jsRedirectHomepage($message) |
104 | 104 | { |
105 | - $homepageUrl = url(HomePage\Model\HomePage::pathOfUser()); |
|
105 | + $homepageUrl = url(HomePage\Model\HomePage::pathOfUser()); |
|
106 | 106 | |
107 | - $redirectJs = $this->jsRedirectConfirm($homepageUrl, $message)->jsRender(); |
|
107 | + $redirectJs = $this->jsRedirectConfirm($homepageUrl, $message)->jsRender(); |
|
108 | 108 | |
109 | - if ($this->isJsonRequest()) { |
|
110 | - $this->outputResponseJSON([ |
|
111 | - 'success' => true, |
|
112 | - 'message' => $message, |
|
113 | - 'atkjs' => $redirectJs |
|
114 | - ]); |
|
115 | - } |
|
116 | - else { |
|
117 | - $this->outputResponseHTML($this->getTag('script', $redirectJs)); |
|
118 | - } |
|
109 | + if ($this->isJsonRequest()) { |
|
110 | + $this->outputResponseJSON([ |
|
111 | + 'success' => true, |
|
112 | + 'message' => $message, |
|
113 | + 'atkjs' => $redirectJs |
|
114 | + ]); |
|
115 | + } |
|
116 | + else { |
|
117 | + $this->outputResponseHTML($this->getTag('script', $redirectJs)); |
|
118 | + } |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | /** |
@@ -127,9 +127,9 @@ discard block |
||
127 | 127 | */ |
128 | 128 | public function jsRedirectConfirm($page, $message) |
129 | 129 | { |
130 | - $redirectJs = $this->jsRedirect($page)->jsRender(); |
|
130 | + $redirectJs = $this->jsRedirect($page)->jsRender(); |
|
131 | 131 | |
132 | - return new \atk4\ui\JsExpression("if (confirm([])) { $redirectJs }", [$message]); |
|
132 | + return new \atk4\ui\JsExpression("if (confirm([])) { $redirectJs }", [$message]); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | /** |
@@ -21,14 +21,14 @@ |
||
21 | 21 | |
22 | 22 | public function install() |
23 | 23 | { |
24 | - Model\HomePage::migrate(); |
|
24 | + Model\HomePage::migrate(); |
|
25 | 25 | |
26 | 26 | // setup default home pages |
27 | 27 | Model\HomePage::create()->import([ |
28 | - [ |
|
29 | - 'path' => 'view/dashboard', |
|
30 | - 'role' => 'Super Admin' |
|
31 | - ], |
|
28 | + [ |
|
29 | + 'path' => 'view/dashboard', |
|
30 | + 'role' => 'Super Admin' |
|
31 | + ], |
|
32 | 32 | [ |
33 | 33 | 'path' => 'view/dashboard', |
34 | 34 | 'role' => 'Employee' |
@@ -23,7 +23,7 @@ |
||
23 | 23 | |
24 | 24 | $grid = $this->add([ |
25 | 25 | Crud::class, |
26 | - 'menu' => ActionBar::instance(), |
|
26 | + 'menu' => ActionBar::instance(), |
|
27 | 27 | // 'model' => HomePage::create(), |
28 | 28 | 'displayFields' => ['path', 'role'], |
29 | 29 | 'editFields' => ['path', 'role'], |
@@ -50,7 +50,7 @@ |
||
50 | 50 | |
51 | 51 | // $plugin->extendList('path'); |
52 | 52 | |
53 | - $grid->addDragHandler()->onReorder(function ($order) { |
|
53 | + $grid->addDragHandler()->onReorder(function($order) { |
|
54 | 54 | foreach (Model\HomePage::create() as $homepage) { |
55 | 55 | $homepage->save(['priority' => array_search($homepage['id'], $order)]); |
56 | 56 | } |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | class HomePage extends Model |
13 | 13 | { |
14 | - use HasEpesiConnection; |
|
14 | + use HasEpesiConnection; |
|
15 | 15 | |
16 | 16 | public $table = 'home_pages'; |
17 | 17 | |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | parent::init(); |
32 | 32 | |
33 | 33 | $this->addFields([ |
34 | - 'path' => [ |
|
34 | + 'path' => [ |
|
35 | 35 | 'caption' => __('Page'), |
36 | 36 | 'values' => self::list(), |
37 | 37 | 'ui' => [ |
@@ -41,23 +41,23 @@ discard block |
||
41 | 41 | 'filter' => true |
42 | 42 | ], |
43 | 43 | ], |
44 | - 'role' => [ |
|
44 | + 'role' => [ |
|
45 | 45 | 'caption' => __('Role'), |
46 | 46 | 'values' => Role::get()->pluck('name', 'name')->all(), |
47 | 47 | 'ui' => [ |
48 | 48 | 'filter' => true |
49 | 49 | ] |
50 | 50 | ], |
51 | - 'date' => [ |
|
51 | + 'date' => [ |
|
52 | 52 | 'type' => 'date', |
53 | 53 | 'caption' => __('Date'), |
54 | - 'never_persist' => true, |
|
54 | + 'never_persist' => true, |
|
55 | 55 | 'ui' => [ |
56 | 56 | 'filter' => true |
57 | 57 | ] |
58 | 58 | ], |
59 | 59 | 'priority' => [ |
60 | - 'default' => 0 |
|
60 | + 'default' => 0 |
|
61 | 61 | ], |
62 | 62 | ]); |
63 | 63 |
@@ -24,11 +24,11 @@ |
||
24 | 24 | |
25 | 25 | public function migrate() |
26 | 26 | { |
27 | - Model\Module::migrate(); |
|
27 | + Model\Module::migrate(); |
|
28 | 28 | |
29 | - Model\Variable::migrate(); |
|
29 | + Model\Variable::migrate(); |
|
30 | 30 | |
31 | - return parent::migrate(); |
|
31 | + return parent::migrate(); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | } |
@@ -7,18 +7,18 @@ |
||
7 | 7 | |
8 | 8 | class SQL extends \atk4\data\Persistence\Sql |
9 | 9 | { |
10 | - /** |
|
11 | - * Take a laravel connection and pass it to ATK Data |
|
12 | - * |
|
13 | - * @return \atk4\data\Persistence\SQL |
|
14 | - */ |
|
15 | - public function __construct(DatabaseManager $database) |
|
16 | - { |
|
17 | - $pdo = $database->connection()->getPdo(); |
|
10 | + /** |
|
11 | + * Take a laravel connection and pass it to ATK Data |
|
12 | + * |
|
13 | + * @return \atk4\data\Persistence\SQL |
|
14 | + */ |
|
15 | + public function __construct(DatabaseManager $database) |
|
16 | + { |
|
17 | + $pdo = $database->connection()->getPdo(); |
|
18 | 18 | |
19 | - // temporary fix of atk4/data inability to handle PREPARE on 'is null' |
|
20 | - $pdo->setAttribute(\PDO::ATTR_EMULATE_PREPARES, true); |
|
19 | + // temporary fix of atk4/data inability to handle PREPARE on 'is null' |
|
20 | + $pdo->setAttribute(\PDO::ATTR_EMULATE_PREPARES, true); |
|
21 | 21 | |
22 | - parent::__construct(Connection::connect($pdo)); |
|
23 | - } |
|
22 | + parent::__construct(Connection::connect($pdo)); |
|
23 | + } |
|
24 | 24 | } |
@@ -43,12 +43,12 @@ discard block |
||
43 | 43 | 'icon' => 'th' |
44 | 44 | ], new LaunchPad($this)); |
45 | 45 | |
46 | - foreach(UserMenuJoint::collect() as $joint) { |
|
47 | - foreach ($joint->tools()?: [] as $tool) { |
|
46 | + foreach (UserMenuJoint::collect() as $joint) { |
|
47 | + foreach ($joint->tools() ?: [] as $tool) { |
|
48 | 48 | $this->addTool($tool); |
49 | 49 | } |
50 | 50 | |
51 | - foreach ($joint->entries()?: [] as $entry) { |
|
51 | + foreach ($joint->entries() ?: [] as $entry) { |
|
52 | 52 | $this->addEntry($entry); |
53 | 53 | } |
54 | 54 | } |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | 'item' => ['Logout', 'icon' => 'sign out', 'attr' => ['onclick' => "event.preventDefault();$('#logout-form').submit();"]], |
67 | 67 | 'action' => url('logout'), |
68 | 68 | 'group' => '10000:user', |
69 | - 'callback' => function ($item) { |
|
69 | + 'callback' => function($item) { |
|
70 | 70 | $logoutForm = View::addTo($item, [ |
71 | 71 | 'id' => 'logout-form', |
72 | 72 | 'attr' => [ |
@@ -95,14 +95,14 @@ discard block |
||
95 | 95 | |
96 | 96 | public function getUserMenuLabel() |
97 | 97 | { |
98 | - return $this->userMenuLabel?: Auth::user()->name; |
|
98 | + return $this->userMenuLabel ?: Auth::user()->name; |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | public function addEntry($entry) |
102 | 102 | { |
103 | 103 | $entry = collect(array_merge(['item' => $entry, 'group' => '00500:general', 'weight' => 10], $entry)); |
104 | 104 | |
105 | - if (! $entry->get('item')) return; |
|
105 | + if (!$entry->get('item')) return; |
|
106 | 106 | |
107 | 107 | $this->entries->add($entry); |
108 | 108 | } |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | |
131 | 131 | $item = $this->userMenu->addItem($entry['item'], $entry->get('action')); |
132 | 132 | |
133 | - if (! $callback = $entry->get('callback')) continue; |
|
133 | + if (!$callback = $entry->get('callback')) continue; |
|
134 | 134 | |
135 | 135 | $callback($item); |
136 | 136 | } |