@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | |
9 | 9 | class NavMenu extends BaseMenu |
10 | 10 | { |
11 | - public $ui = 'inverted nav menu'; |
|
11 | + public $ui = 'inverted nav menu'; |
|
12 | 12 | |
13 | 13 | public function init() |
14 | 14 | public function init(): void |
@@ -62,12 +62,12 @@ discard block |
||
62 | 62 | self::addItems($submenu, collect($subitems)); |
63 | 63 | } |
64 | 64 | elseif ($subitems = $entry['group'] ?? []) { |
65 | - $subgroup = $menu->addGroup($entry['item']); |
|
65 | + $subgroup = $menu->addGroup($entry['item']); |
|
66 | 66 | |
67 | 67 | self::addItems($subgroup, collect($subitems)); |
68 | 68 | } |
69 | 69 | else { |
70 | - $menu->addItem($entry['item'], $entry['action'] ?? ''); |
|
70 | + $menu->addItem($entry['item'], $entry['action'] ?? ''); |
|
71 | 71 | } |
72 | 72 | }); |
73 | 73 | } |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | $this->addHeader($this->app->title); |
19 | 19 | |
20 | 20 | $items = collect(); |
21 | - foreach(NavMenuJoint::collect() as $joint) { |
|
21 | + foreach (NavMenuJoint::collect() as $joint) { |
|
22 | 22 | $items = $items->merge($joint->items()); |
23 | 23 | } |
24 | 24 | |
@@ -35,13 +35,13 @@ discard block |
||
35 | 35 | |
36 | 36 | public static function addItems($menu, Collection $items) |
37 | 37 | { |
38 | - $items->sort(function ($entry1, $entry2) { |
|
39 | - $weight1 = $entry1['weight']?? 10; |
|
40 | - $weight2 = $entry2['weight']?? 10; |
|
38 | + $items->sort(function($entry1, $entry2) { |
|
39 | + $weight1 = $entry1['weight'] ?? 10; |
|
40 | + $weight2 = $entry2['weight'] ?? 10; |
|
41 | 41 | |
42 | 42 | return $weight1 <=> $weight2; |
43 | 43 | })->map(function($entry, $caption) use ($menu) { |
44 | - if (! ($entry['access'] ?? true)) return; |
|
44 | + if (!($entry['access'] ?? true)) return; |
|
45 | 45 | |
46 | 46 | if (!is_array($entry)) { |
47 | 47 | $entry = ['action' => $entry]; |
@@ -32,53 +32,53 @@ discard block |
||
32 | 32 | */ |
33 | 33 | class LayoutView extends ModuleView |
34 | 34 | { |
35 | - use SessionTrait; |
|
35 | + use SessionTrait; |
|
36 | 36 | |
37 | - /** |
|
38 | - * @var View\NavMenu |
|
39 | - */ |
|
40 | - public $menuLeft; // vertical menu |
|
37 | + /** |
|
38 | + * @var View\NavMenu |
|
39 | + */ |
|
40 | + public $menuLeft; // vertical menu |
|
41 | 41 | |
42 | - /** |
|
43 | - * @var \atk4\ui\Menu |
|
44 | - */ |
|
45 | - public $menu; // horizontal menu |
|
42 | + /** |
|
43 | + * @var \atk4\ui\Menu |
|
44 | + */ |
|
45 | + public $menu; // horizontal menu |
|
46 | 46 | |
47 | - /** |
|
48 | - * @var \atk4\ui\Menu |
|
49 | - */ |
|
50 | - public $menuRight; // vertical pull-down |
|
47 | + /** |
|
48 | + * @var \atk4\ui\Menu |
|
49 | + */ |
|
50 | + public $menuRight; // vertical pull-down |
|
51 | 51 | |
52 | - /** |
|
53 | - * @var View\ActionBar |
|
54 | - */ |
|
55 | - public $actionBar; |
|
56 | - public $locationBar; |
|
52 | + /** |
|
53 | + * @var View\ActionBar |
|
54 | + */ |
|
55 | + public $actionBar; |
|
56 | + public $locationBar; |
|
57 | 57 | |
58 | - public $burger = true; // burger menu item |
|
58 | + public $burger = true; // burger menu item |
|
59 | 59 | |
60 | - /* |
|
60 | + /* |
|
61 | 61 | * Whether or not left Menu is visible on Page load. |
62 | 62 | */ |
63 | - public $isMenuLeftVisible = true; |
|
63 | + public $isMenuLeftVisible = true; |
|
64 | 64 | |
65 | - public $defaultTemplate = 'layout/admin.html'; |
|
65 | + public $defaultTemplate = 'layout/admin.html'; |
|
66 | 66 | |
67 | - protected $location; |
|
67 | + protected $location; |
|
68 | 68 | |
69 | - public function init(): void |
|
70 | - { |
|
71 | - parent::init(); |
|
69 | + public function init(): void |
|
70 | + { |
|
71 | + parent::init(); |
|
72 | 72 | |
73 | - $this->setMenu(); |
|
74 | - $this->setActionBar(); |
|
73 | + $this->setMenu(); |
|
74 | + $this->setActionBar(); |
|
75 | 75 | |
76 | 76 | // if (request()->pjax()) return; |
77 | 77 | |
78 | - $this->setMenuLeft(); |
|
79 | - $this->setMenuRight(); |
|
78 | + $this->setMenuLeft(); |
|
79 | + $this->setMenuRight(); |
|
80 | 80 | |
81 | - $this->setVersion(); |
|
81 | + $this->setVersion(); |
|
82 | 82 | |
83 | 83 | // $this->js(true, null, 'body')->niceScroll(); |
84 | 84 | |
@@ -87,25 +87,25 @@ discard block |
||
87 | 87 | // if (event.originalEvent.persisted) { |
88 | 88 | // window.location.reload(); |
89 | 89 | // }')])); |
90 | - } |
|
90 | + } |
|
91 | 91 | |
92 | - public function setMenu() |
|
93 | - { |
|
94 | - if ($this->menu) return; |
|
92 | + public function setMenu() |
|
93 | + { |
|
94 | + if ($this->menu) return; |
|
95 | 95 | |
96 | - $this->menu = $this->add(['Menu', 'atk-topMenu fixed horizontal', 'element' => 'header'], 'TopMenu'); |
|
96 | + $this->menu = $this->add(['Menu', 'atk-topMenu fixed horizontal', 'element' => 'header'], 'TopMenu'); |
|
97 | 97 | |
98 | - // company logo |
|
99 | - // see \Epesi\Core\Controller::logo |
|
100 | - $this->menu->add(['class' => ['epesi-logo'], 'style' => ['width' => '167px']])->add(['Image', url('logo')])->setStyle(['max-height' => '32px']); |
|
98 | + // company logo |
|
99 | + // see \Epesi\Core\Controller::logo |
|
100 | + $this->menu->add(['class' => ['epesi-logo'], 'style' => ['width' => '167px']])->add(['Image', url('logo')])->setStyle(['max-height' => '32px']); |
|
101 | 101 | |
102 | - if ($this->burger) { |
|
103 | - $this->burger = $this->menu->addItem(['class' => ['icon atk-leftMenuTrigger']]); |
|
104 | - } |
|
102 | + if ($this->burger) { |
|
103 | + $this->burger = $this->menu->addItem(['class' => ['icon atk-leftMenuTrigger']]); |
|
104 | + } |
|
105 | 105 | |
106 | 106 | // home icon redirects to /home path |
107 | 107 | // see \Epesi\Core\Controller::home |
108 | - $this->menu->addItem(['class' => ['icon epesi-home']], url('home'))->add(['Icon', 'home']); |
|
108 | + $this->menu->addItem(['class' => ['icon epesi-home']], url('home'))->add(['Icon', 'home']); |
|
109 | 109 | |
110 | 110 | // location bar |
111 | 111 | $this->locationBar = $this->menu->add(['View', ['ui' => 'epesi-location']]); |
@@ -148,49 +148,49 @@ discard block |
||
148 | 148 | ]), 'RightMenu')->addClass('right menu')->removeClass('item'); |
149 | 149 | } |
150 | 150 | |
151 | - public function setMenuLeft() |
|
152 | - { |
|
153 | - if ($this->menuLeft) return; |
|
151 | + public function setMenuLeft() |
|
152 | + { |
|
153 | + if ($this->menuLeft) return; |
|
154 | 154 | |
155 | - $this->menuLeft = View\NavMenu::addTo($this, 'left vertical labeled sidebar', ['LeftMenu']); |
|
155 | + $this->menuLeft = View\NavMenu::addTo($this, 'left vertical labeled sidebar', ['LeftMenu']); |
|
156 | 156 | |
157 | - if (! $this->burger) return; |
|
157 | + if (! $this->burger) return; |
|
158 | 158 | |
159 | - $this->isMenuLeftVisible = $this->learn('menu', $this->isMenuLeftVisible); |
|
159 | + $this->isMenuLeftVisible = $this->learn('menu', $this->isMenuLeftVisible); |
|
160 | 160 | |
161 | - $this->burger->add(['Icon', 'content'])->on('click', [ |
|
162 | - (new jQuery('.ui.left.sidebar'))->toggleClass('visible'), |
|
163 | - (new jQuery('.epesi-logo'))->toggleClass('expanded'), |
|
164 | - (new jQuery('body'))->toggleClass('atk-leftMenu-visible'), |
|
165 | - $this->burger->add('jsCallback')->set(function($j, $visible) { |
|
166 | - $this->memorize('menu', filter_var($visible, FILTER_VALIDATE_BOOLEAN)); |
|
167 | - }, [$this->menuLeft->js(true)->hasClass('visible')]) |
|
168 | - ]); |
|
169 | - } |
|
161 | + $this->burger->add(['Icon', 'content'])->on('click', [ |
|
162 | + (new jQuery('.ui.left.sidebar'))->toggleClass('visible'), |
|
163 | + (new jQuery('.epesi-logo'))->toggleClass('expanded'), |
|
164 | + (new jQuery('body'))->toggleClass('atk-leftMenu-visible'), |
|
165 | + $this->burger->add('jsCallback')->set(function($j, $visible) { |
|
166 | + $this->memorize('menu', filter_var($visible, FILTER_VALIDATE_BOOLEAN)); |
|
167 | + }, [$this->menuLeft->js(true)->hasClass('visible')]) |
|
168 | + ]); |
|
169 | + } |
|
170 | 170 | |
171 | - public function setActionBar() |
|
172 | - { |
|
173 | - if ($this->actionBar) return; |
|
171 | + public function setActionBar() |
|
172 | + { |
|
173 | + if ($this->actionBar) return; |
|
174 | 174 | |
175 | - $this->actionBar = View\ActionBar::addTo($this, [], ['ActionBar']); |
|
175 | + $this->actionBar = View\ActionBar::addTo($this, [], ['ActionBar']); |
|
176 | 176 | |
177 | - return $this; |
|
178 | - } |
|
177 | + return $this; |
|
178 | + } |
|
179 | 179 | |
180 | - public function setVersion() |
|
181 | - { |
|
182 | - $this->template->trySet('version', $this->app->version); |
|
183 | - } |
|
180 | + public function setVersion() |
|
181 | + { |
|
182 | + $this->template->trySet('version', $this->app->version); |
|
183 | + } |
|
184 | 184 | |
185 | - /** |
|
186 | - * {@inheritdoc} |
|
187 | - */ |
|
185 | + /** |
|
186 | + * {@inheritdoc} |
|
187 | + */ |
|
188 | 188 | |
189 | - public function renderView() |
|
190 | - { |
|
191 | - if ($this->menuLeft && $this->isMenuLeftVisible) { |
|
192 | - $this->menuLeft->addClass('visible'); |
|
193 | - } |
|
194 | - parent::renderView(); |
|
195 | - } |
|
189 | + public function renderView() |
|
190 | + { |
|
191 | + if ($this->menuLeft && $this->isMenuLeftVisible) { |
|
192 | + $this->menuLeft->addClass('visible'); |
|
193 | + } |
|
194 | + parent::renderView(); |
|
195 | + } |
|
196 | 196 | } |
@@ -37,17 +37,17 @@ discard block |
||
37 | 37 | /** |
38 | 38 | * @var View\NavMenu |
39 | 39 | */ |
40 | - public $menuLeft; // vertical menu |
|
40 | + public $menuLeft; // vertical menu |
|
41 | 41 | |
42 | 42 | /** |
43 | 43 | * @var \atk4\ui\Menu |
44 | 44 | */ |
45 | - public $menu; // horizontal menu |
|
45 | + public $menu; // horizontal menu |
|
46 | 46 | |
47 | 47 | /** |
48 | 48 | * @var \atk4\ui\Menu |
49 | 49 | */ |
50 | - public $menuRight; // vertical pull-down |
|
50 | + public $menuRight; // vertical pull-down |
|
51 | 51 | |
52 | 52 | /** |
53 | 53 | * @var View\ActionBar |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | public $actionBar; |
56 | 56 | public $locationBar; |
57 | 57 | |
58 | - public $burger = true; // burger menu item |
|
58 | + public $burger = true; // burger menu item |
|
59 | 59 | |
60 | 60 | /* |
61 | 61 | * Whether or not left Menu is visible on Page load. |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | $this->menu->addItem(['class' => ['icon epesi-home']], url('home'))->add(['Icon', 'home']); |
109 | 109 | |
110 | 110 | // location bar |
111 | - $this->locationBar = $this->menu->add(['View', ['ui' => 'epesi-location']]); |
|
111 | + $this->locationBar = $this->menu->add(['View', ['ui' => 'epesi-location']]); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | public function setLocation($crumbs) |
@@ -119,8 +119,8 @@ discard block |
||
119 | 119 | |
120 | 120 | $title = []; |
121 | 121 | foreach ($crumbs as $level) { |
122 | - $label = $level['label']?? $level; |
|
123 | - $link = $level['link']?? null; |
|
122 | + $label = $level['label'] ?? $level; |
|
123 | + $link = $level['link'] ?? null; |
|
124 | 124 | |
125 | 125 | $crumb->addCrumb($label, $link); |
126 | 126 | |
@@ -154,11 +154,11 @@ discard block |
||
154 | 154 | |
155 | 155 | $this->menuLeft = View\NavMenu::addTo($this, 'left vertical labeled sidebar', ['LeftMenu']); |
156 | 156 | |
157 | - if (! $this->burger) return; |
|
157 | + if (!$this->burger) return; |
|
158 | 158 | |
159 | 159 | $this->isMenuLeftVisible = $this->learn('menu', $this->isMenuLeftVisible); |
160 | 160 | |
161 | - $this->burger->add(['Icon', 'content'])->on('click', [ |
|
161 | + $this->burger->add(['Icon', 'content'])->on('click', [ |
|
162 | 162 | (new jQuery('.ui.left.sidebar'))->toggleClass('visible'), |
163 | 163 | (new jQuery('.epesi-logo'))->toggleClass('expanded'), |
164 | 164 | (new jQuery('body'))->toggleClass('atk-leftMenu-visible'), |
@@ -91,7 +91,9 @@ discard block |
||
91 | 91 | |
92 | 92 | public function setMenu() |
93 | 93 | { |
94 | - if ($this->menu) return; |
|
94 | + if ($this->menu) { |
|
95 | + return; |
|
96 | + } |
|
95 | 97 | |
96 | 98 | $this->menu = $this->add(['Menu', 'atk-topMenu fixed horizontal', 'element' => 'header'], 'TopMenu'); |
97 | 99 | |
@@ -141,7 +143,9 @@ discard block |
||
141 | 143 | |
142 | 144 | public function setMenuRight() |
143 | 145 | { |
144 | - if ($this->menuRight) return; |
|
146 | + if ($this->menuRight) { |
|
147 | + return; |
|
148 | + } |
|
145 | 149 | |
146 | 150 | $this->menuRight = $this->menu->add(new View\RightMenu([ |
147 | 151 | 'ui' => false |
@@ -150,11 +154,15 @@ discard block |
||
150 | 154 | |
151 | 155 | public function setMenuLeft() |
152 | 156 | { |
153 | - if ($this->menuLeft) return; |
|
157 | + if ($this->menuLeft) { |
|
158 | + return; |
|
159 | + } |
|
154 | 160 | |
155 | 161 | $this->menuLeft = View\NavMenu::addTo($this, 'left vertical labeled sidebar', ['LeftMenu']); |
156 | 162 | |
157 | - if (! $this->burger) return; |
|
163 | + if (! $this->burger) { |
|
164 | + return; |
|
165 | + } |
|
158 | 166 | |
159 | 167 | $this->isMenuLeftVisible = $this->learn('menu', $this->isMenuLeftVisible); |
160 | 168 | |
@@ -170,7 +178,9 @@ discard block |
||
170 | 178 | |
171 | 179 | public function setActionBar() |
172 | 180 | { |
173 | - if ($this->actionBar) return; |
|
181 | + if ($this->actionBar) { |
|
182 | + return; |
|
183 | + } |
|
174 | 184 | |
175 | 185 | $this->actionBar = View\ActionBar::addTo($this, [], ['ActionBar']); |
176 | 186 |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | |
80 | 80 | $form->addField('language', ['DropDown', 'values' => $values, 'caption' => __('Select Language'), 'iconLeft' => 'globe'], ['required'=>true])->set($wizard->recall('language', 'en')); |
81 | 81 | |
82 | - $form->onSubmit(function ($form) use ($wizard) { |
|
82 | + $form->onSubmit(function($form) use ($wizard) { |
|
83 | 83 | $wizard->memorize('language', $form->model['language']); |
84 | 84 | |
85 | 85 | App::setLocale($form->model['language']); |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | $form->addField('support', ['CheckBox', 'caption' => __('I will not remove "Support -> About" credit page from the application menu.')], ['required'=>true]); |
112 | 112 | $form->addField('store', ['CheckBox', 'caption' => __('I will not remove or rename ":epesi Store" links from the application.', ['epesi' => config('epesi.ui.title')])], ['required'=>true]); |
113 | 113 | |
114 | - $form->onSubmit(function ($form) use ($wizard) { |
|
114 | + $form->onSubmit(function($form) use ($wizard) { |
|
115 | 115 | return $wizard->jsNext(); |
116 | 116 | }); |
117 | 117 | |
@@ -139,12 +139,12 @@ discard block |
||
139 | 139 | $form->addField('create', ['CheckBox', 'caption' => __('Create New Database')])->on('change', new jsExpression('if ($(event.target).is(":checked")) alert([])', [__('WARNING: Make sure you have CREATE access level to do this!')])); |
140 | 140 | |
141 | 141 | foreach ($wizard->recall('connection', []) as $name => $value) { |
142 | - if (! $field = $form->fields[$name]?? null) continue; |
|
142 | + if (!$field = $form->fields[$name] ?? null) continue; |
|
143 | 143 | |
144 | 144 | $field->set($value); |
145 | 145 | } |
146 | 146 | |
147 | - $form->onSubmit(function ($form) use ($wizard) { |
|
147 | + $form->onSubmit(function($form) use ($wizard) { |
|
148 | 148 | $connection = $form->model->get(); |
149 | 149 | |
150 | 150 | $wizard->memorize('connection', $connection); |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | |
193 | 193 | $form->model->set($wizard->recall('user')); |
194 | 194 | |
195 | - $form->validate(function ($form) use ($wizard) { |
|
195 | + $form->validate(function($form) use ($wizard) { |
|
196 | 196 | $wizard->memorize('user', $form->model->get()); |
197 | 197 | |
198 | 198 | return $wizard->jsNext(); |
@@ -7,19 +7,19 @@ |
||
7 | 7 | |
8 | 8 | class Module extends Model |
9 | 9 | { |
10 | - use HasEpesiConnection; |
|
10 | + use HasEpesiConnection; |
|
11 | 11 | |
12 | - public $table = 'modules'; |
|
12 | + public $table = 'modules'; |
|
13 | 13 | |
14 | - function init(): void |
|
15 | - { |
|
16 | - parent::init(); |
|
14 | + function init(): void |
|
15 | + { |
|
16 | + parent::init(); |
|
17 | 17 | |
18 | - $this->addFields([ |
|
19 | - 'class', |
|
20 | - 'alias', |
|
21 | - 'priority' => ['default' => 0], |
|
22 | - 'state' => ['default' => 1] |
|
23 | - ]); |
|
24 | - } |
|
18 | + $this->addFields([ |
|
19 | + 'class', |
|
20 | + 'alias', |
|
21 | + 'priority' => ['default' => 0], |
|
22 | + 'state' => ['default' => 1] |
|
23 | + ]); |
|
24 | + } |
|
25 | 25 | } |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | |
9 | 9 | class Variable extends Model |
10 | 10 | { |
11 | - use HasEpesiConnection; |
|
11 | + use HasEpesiConnection; |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * @var Collection |
@@ -27,12 +27,12 @@ discard block |
||
27 | 27 | |
28 | 28 | public function init(): void |
29 | 29 | { |
30 | - parent::init(); |
|
30 | + parent::init(); |
|
31 | 31 | |
32 | - $this->addFields([ |
|
33 | - 'name', |
|
34 | - 'value' => ['type' => 'text', 'serialize' => 'base64'] |
|
35 | - ]); |
|
32 | + $this->addFields([ |
|
33 | + 'name', |
|
34 | + 'value' => ['type' => 'text', 'serialize' => 'base64'] |
|
35 | + ]); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | public static function recall($name, $default = null) { |
@@ -57,10 +57,10 @@ discard block |
||
57 | 57 | $variable = self::create()->addCondition('name', $name)->tryLoadAny(); |
58 | 58 | |
59 | 59 | if ($variable->loaded()) { |
60 | - $variable->save(compact('value')); |
|
60 | + $variable->save(compact('value')); |
|
61 | 61 | } |
62 | 62 | else { |
63 | - $variable->insert(compact('name', 'value')); |
|
63 | + $variable->insert(compact('name', 'value')); |
|
64 | 64 | } |
65 | 65 | } |
66 | 66 |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | public $strict_types = false; |
21 | 21 | |
22 | 22 | private static function cache() { |
23 | - if(isset(self::$variables)) return; |
|
23 | + if (isset(self::$variables)) return; |
|
24 | 24 | |
25 | 25 | self::$variables = self::pluck('value', 'name'); |
26 | 26 | } |
@@ -38,9 +38,9 @@ discard block |
||
38 | 38 | public static function recall($name, $default = null) { |
39 | 39 | self::cache(); |
40 | 40 | |
41 | - if (! self::$variables->has($name)) return $default; |
|
41 | + if (!self::$variables->has($name)) return $default; |
|
42 | 42 | |
43 | - return self::$variables->get($name, $default)?? $default; |
|
43 | + return self::$variables->get($name, $default) ?? $default; |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | public static function memorize($name, $value) { |
@@ -64,10 +64,10 @@ discard block |
||
64 | 64 | } |
65 | 65 | } |
66 | 66 | |
67 | - public static function forget($name, $throwError=true) { |
|
67 | + public static function forget($name, $throwError = true) { |
|
68 | 68 | self::cache(); |
69 | 69 | |
70 | - if (! self::$variables->has($name) && $throwError) { |
|
70 | + if (!self::$variables->has($name) && $throwError) { |
|
71 | 71 | throw new \Exception('No such variable in database: ' . $name); |
72 | 72 | } |
73 | 73 |