@@ -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 System\SystemInstallWizard()); |
|
33 | + $ui->add(new 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 | } |
@@ -47,12 +47,12 @@ discard block |
||
47 | 47 | 'icon' => 'th' |
48 | 48 | ], Launchpad::addTo($this)->getJsModal()); |
49 | 49 | |
50 | - foreach(UserMenuJoint::collect() as $joint) { |
|
51 | - foreach ($joint->tools()?: [] as $tool) { |
|
50 | + foreach (UserMenuJoint::collect() as $joint) { |
|
51 | + foreach ($joint->tools() ?: [] as $tool) { |
|
52 | 52 | $this->addTool($tool); |
53 | 53 | } |
54 | 54 | |
55 | - foreach ($joint->entries()?: [] as $entry) { |
|
55 | + foreach ($joint->entries() ?: [] as $entry) { |
|
56 | 56 | $this->addEntry($entry); |
57 | 57 | } |
58 | 58 | } |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | 'item' => ['Logout', 'icon' => 'sign out', 'attr' => ['onclick' => "event.preventDefault();$('#logout-form').submit();"]], |
71 | 71 | 'action' => url('logout'), |
72 | 72 | 'group' => '10000:user', |
73 | - 'callback' => function ($item) { |
|
73 | + 'callback' => function($item) { |
|
74 | 74 | $logoutForm = View::addTo($item, [ |
75 | 75 | 'id' => 'logout-form', |
76 | 76 | 'attr' => [ |
@@ -99,14 +99,14 @@ discard block |
||
99 | 99 | |
100 | 100 | public function getUserMenuLabel() |
101 | 101 | { |
102 | - return $this->userMenuLabel?: Auth::user()->name; |
|
102 | + return $this->userMenuLabel ?: Auth::user()->name; |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | public function addEntry($entry) |
106 | 106 | { |
107 | 107 | $entry = collect(array_merge(['item' => $entry, 'group' => '00500:general', 'weight' => 10], $entry)); |
108 | 108 | |
109 | - if (! $entry->get('item')) return; |
|
109 | + if (!$entry->get('item')) return; |
|
110 | 110 | |
111 | 111 | $this->entries->add($entry); |
112 | 112 | } |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | |
135 | 135 | $item = $this->userMenu->addItem($entry['item'], $entry->get('action')); |
136 | 136 | |
137 | - if (! $callback = $entry->get('callback')) continue; |
|
137 | + if (!$callback = $entry->get('callback')) continue; |
|
138 | 138 | |
139 | 139 | $callback($item); |
140 | 140 | } |
@@ -27,27 +27,27 @@ |
||
27 | 27 | return new JsModal($this->title, $this->virtualPage); |
28 | 28 | } |
29 | 29 | |
30 | - protected function getContents(VirtualPage $vp) |
|
31 | - { |
|
32 | - $vp->add([ |
|
33 | - new LaunchButton([ |
|
34 | - 'label' => 'Test Button 1', |
|
35 | - 'icon' => 'user' |
|
36 | - ]) |
|
37 | - ])->link(URL::to('/')); |
|
30 | + protected function getContents(VirtualPage $vp) |
|
31 | + { |
|
32 | + $vp->add([ |
|
33 | + new LaunchButton([ |
|
34 | + 'label' => 'Test Button 1', |
|
35 | + 'icon' => 'user' |
|
36 | + ]) |
|
37 | + ])->link(URL::to('/')); |
|
38 | 38 | |
39 | - $vp->add([ |
|
40 | - new LaunchButton([ |
|
41 | - 'label' => 'Test Button 2', |
|
42 | - 'icon' => 'car' |
|
43 | - ]) |
|
44 | - ]); |
|
39 | + $vp->add([ |
|
40 | + new LaunchButton([ |
|
41 | + 'label' => 'Test Button 2', |
|
42 | + 'icon' => 'car' |
|
43 | + ]) |
|
44 | + ]); |
|
45 | 45 | |
46 | - $vp->add([ |
|
47 | - new LaunchButton([ |
|
48 | - 'label' => 'Test Button 3', |
|
49 | - 'icon' => 'bus' |
|
50 | - ]) |
|
51 | - ]); |
|
52 | - } |
|
46 | + $vp->add([ |
|
47 | + new LaunchButton([ |
|
48 | + 'label' => 'Test Button 3', |
|
49 | + 'icon' => 'bus' |
|
50 | + ]) |
|
51 | + ]); |
|
52 | + } |
|
53 | 53 | } |
@@ -10,53 +10,53 @@ discard block |
||
10 | 10 | |
11 | 11 | class LayoutView extends \atk4\ui\Layout |
12 | 12 | { |
13 | - use SessionTrait; |
|
13 | + use SessionTrait; |
|
14 | 14 | |
15 | - /** |
|
16 | - * @var View\NavMenu |
|
17 | - */ |
|
18 | - public $menuLeft; // vertical menu |
|
15 | + /** |
|
16 | + * @var View\NavMenu |
|
17 | + */ |
|
18 | + public $menuLeft; // vertical menu |
|
19 | 19 | |
20 | - /** |
|
21 | - * @var \atk4\ui\Menu |
|
22 | - */ |
|
23 | - public $menuTop; // horizontal menu |
|
20 | + /** |
|
21 | + * @var \atk4\ui\Menu |
|
22 | + */ |
|
23 | + public $menuTop; // horizontal menu |
|
24 | 24 | |
25 | - /** |
|
26 | - * @var \atk4\ui\Menu |
|
27 | - */ |
|
28 | - public $menuRight; // vertical pull-down |
|
25 | + /** |
|
26 | + * @var \atk4\ui\Menu |
|
27 | + */ |
|
28 | + public $menuRight; // vertical pull-down |
|
29 | 29 | |
30 | - /** |
|
31 | - * @var View\ActionBar |
|
32 | - */ |
|
33 | - public $actionBar; |
|
34 | - public $locationBar; |
|
30 | + /** |
|
31 | + * @var View\ActionBar |
|
32 | + */ |
|
33 | + public $actionBar; |
|
34 | + public $locationBar; |
|
35 | 35 | |
36 | - public $burger = true; // burger menu item |
|
36 | + public $burger = true; // burger menu item |
|
37 | 37 | |
38 | - /* |
|
38 | + /* |
|
39 | 39 | * Whether or not left Menu is visible on Page load. |
40 | 40 | */ |
41 | - public $isMenuLeftVisible = true; |
|
41 | + public $isMenuLeftVisible = true; |
|
42 | 42 | |
43 | - public $defaultTemplate = 'layout/admin.html'; |
|
43 | + public $defaultTemplate = 'layout/admin.html'; |
|
44 | 44 | |
45 | - protected $location; |
|
45 | + protected $location; |
|
46 | 46 | |
47 | - protected function init(): void |
|
48 | - { |
|
49 | - parent::init(); |
|
47 | + protected function init(): void |
|
48 | + { |
|
49 | + parent::init(); |
|
50 | 50 | |
51 | - $this->initMenuTop(); |
|
52 | - $this->initActionBar(); |
|
51 | + $this->initMenuTop(); |
|
52 | + $this->initActionBar(); |
|
53 | 53 | |
54 | 54 | // if (request()->pjax()) return; |
55 | 55 | |
56 | - $this->initMenuLeft(); |
|
57 | - $this->initMenuRight(); |
|
56 | + $this->initMenuLeft(); |
|
57 | + $this->initMenuRight(); |
|
58 | 58 | |
59 | - $this->template->trySet('version', $this->getApp()->version); |
|
59 | + $this->template->trySet('version', $this->getApp()->version); |
|
60 | 60 | |
61 | 61 | // $this->js(true, null, 'body')->niceScroll(); |
62 | 62 | |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | // if (event.originalEvent.persisted) { |
66 | 66 | // window.location.reload(); |
67 | 67 | // }')])); |
68 | - } |
|
68 | + } |
|
69 | 69 | |
70 | 70 | /** |
71 | 71 | * @return static |
@@ -127,40 +127,40 @@ discard block |
||
127 | 127 | $this->menuRight = $this->menuTop->add(new View\RightMenu(['ui' => false]), 'RightMenu')->addClass('right menu')->removeClass('item'); |
128 | 128 | } |
129 | 129 | |
130 | - protected function initMenuLeft() |
|
131 | - { |
|
132 | - if ($this->menuLeft) return; |
|
130 | + protected function initMenuLeft() |
|
131 | + { |
|
132 | + if ($this->menuLeft) return; |
|
133 | 133 | |
134 | - $this->menuLeft = View\NavMenu::addTo($this, 'left vertical labeled sidebar', ['LeftMenu']); |
|
134 | + $this->menuLeft = View\NavMenu::addTo($this, 'left vertical labeled sidebar', ['LeftMenu']); |
|
135 | 135 | |
136 | - if ($this->burger) { |
|
137 | - $this->isMenuLeftVisible = $this->learn('menu', $this->isMenuLeftVisible); |
|
136 | + if ($this->burger) { |
|
137 | + $this->isMenuLeftVisible = $this->learn('menu', $this->isMenuLeftVisible); |
|
138 | 138 | |
139 | - $this->burger->add([\atk4\ui\Icon::class, 'content'])->on('click', [ |
|
140 | - (new jQuery('.ui.left.sidebar'))->toggleClass('visible'), |
|
141 | - (new jQuery('.epesi-logo'))->toggleClass('expanded'), |
|
142 | - (new jQuery('body'))->toggleClass('atk-leftMenu-visible'), |
|
143 | - \atk4\ui\JsCallback::addTo($this->burger)->set(function($jsCallback, $visible) { |
|
144 | - $this->memorize('menu', filter_var($visible, FILTER_VALIDATE_BOOLEAN)); |
|
145 | - }, [$this->menuLeft->js(true)->hasClass('visible')]) |
|
146 | - ]); |
|
147 | - } |
|
148 | - } |
|
139 | + $this->burger->add([\atk4\ui\Icon::class, 'content'])->on('click', [ |
|
140 | + (new jQuery('.ui.left.sidebar'))->toggleClass('visible'), |
|
141 | + (new jQuery('.epesi-logo'))->toggleClass('expanded'), |
|
142 | + (new jQuery('body'))->toggleClass('atk-leftMenu-visible'), |
|
143 | + \atk4\ui\JsCallback::addTo($this->burger)->set(function($jsCallback, $visible) { |
|
144 | + $this->memorize('menu', filter_var($visible, FILTER_VALIDATE_BOOLEAN)); |
|
145 | + }, [$this->menuLeft->js(true)->hasClass('visible')]) |
|
146 | + ]); |
|
147 | + } |
|
148 | + } |
|
149 | 149 | |
150 | - protected function initActionBar() |
|
151 | - { |
|
152 | - if (!$this->actionBar) { |
|
153 | - $this->actionBar = View\ActionBar::addTo($this, [], ['ActionBar']); |
|
154 | - } |
|
150 | + protected function initActionBar() |
|
151 | + { |
|
152 | + if (!$this->actionBar) { |
|
153 | + $this->actionBar = View\ActionBar::addTo($this, [], ['ActionBar']); |
|
154 | + } |
|
155 | 155 | |
156 | - return $this; |
|
157 | - } |
|
156 | + return $this; |
|
157 | + } |
|
158 | 158 | |
159 | - public function renderView(): void |
|
160 | - { |
|
161 | - if ($this->menuLeft && $this->isMenuLeftVisible) { |
|
162 | - $this->menuLeft->addClass('visible'); |
|
163 | - } |
|
164 | - parent::renderView(); |
|
165 | - } |
|
159 | + public function renderView(): void |
|
160 | + { |
|
161 | + if ($this->menuLeft && $this->isMenuLeftVisible) { |
|
162 | + $this->menuLeft->addClass('visible'); |
|
163 | + } |
|
164 | + parent::renderView(); |
|
165 | + } |
|
166 | 166 | } |
@@ -15,17 +15,17 @@ discard block |
||
15 | 15 | /** |
16 | 16 | * @var View\NavMenu |
17 | 17 | */ |
18 | - public $menuLeft; // vertical menu |
|
18 | + public $menuLeft; // vertical menu |
|
19 | 19 | |
20 | 20 | /** |
21 | 21 | * @var \atk4\ui\Menu |
22 | 22 | */ |
23 | - public $menuTop; // horizontal menu |
|
23 | + public $menuTop; // horizontal menu |
|
24 | 24 | |
25 | 25 | /** |
26 | 26 | * @var \atk4\ui\Menu |
27 | 27 | */ |
28 | - public $menuRight; // vertical pull-down |
|
28 | + public $menuRight; // vertical pull-down |
|
29 | 29 | |
30 | 30 | /** |
31 | 31 | * @var View\ActionBar |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | public $actionBar; |
34 | 34 | public $locationBar; |
35 | 35 | |
36 | - public $burger = true; // burger menu item |
|
36 | + public $burger = true; // burger menu item |
|
37 | 37 | |
38 | 38 | /* |
39 | 39 | * Whether or not left Menu is visible on Page load. |
@@ -100,7 +100,9 @@ discard block |
||
100 | 100 | |
101 | 101 | protected function initMenuTop() |
102 | 102 | { |
103 | - if ($this->menuTop) return; |
|
103 | + if ($this->menuTop) { |
|
104 | + return; |
|
105 | + } |
|
104 | 106 | |
105 | 107 | $this->menuTop = Menu::addTo($this, ['atk-topMenu fixed horizontal', 'element' => 'header'], ['TopMenu']); |
106 | 108 | |
@@ -122,14 +124,18 @@ discard block |
||
122 | 124 | |
123 | 125 | protected function initMenuRight() |
124 | 126 | { |
125 | - if ($this->menuRight) return; |
|
127 | + if ($this->menuRight) { |
|
128 | + return; |
|
129 | + } |
|
126 | 130 | |
127 | 131 | $this->menuRight = $this->menuTop->add(new View\RightMenu(['ui' => false]), 'RightMenu')->addClass('right menu')->removeClass('item'); |
128 | 132 | } |
129 | 133 | |
130 | 134 | protected function initMenuLeft() |
131 | 135 | { |
132 | - if ($this->menuLeft) return; |
|
136 | + if ($this->menuLeft) { |
|
137 | + return; |
|
138 | + } |
|
133 | 139 | |
134 | 140 | $this->menuLeft = View\NavMenu::addTo($this, 'left vertical labeled sidebar', ['LeftMenu']); |
135 | 141 |
@@ -34,8 +34,8 @@ discard block |
||
34 | 34 | $form->addControl('custom_logo', [\atk4\ui\Form\Control\Checkbox::class, 'caption' => __('Use custom logo')]); |
35 | 35 | |
36 | 36 | $form->model->setMulti([ |
37 | - 'title' => Variable::recall('system.title'), |
|
38 | - 'custom_logo' => (bool) Variable::recall('system.logo') |
|
37 | + 'title' => Variable::recall('system.title'), |
|
38 | + 'custom_logo' => (bool) Variable::recall('system.logo') |
|
39 | 39 | ]); |
40 | 40 | |
41 | 41 | $logo = $form->addControl('logo', [ |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | $storage->move($from, $to); |
77 | 77 | } |
78 | 78 | |
79 | - Variable::memorize('system.logo', $logo); |
|
79 | + Variable::memorize('system.logo', $logo); |
|
80 | 80 | |
81 | 81 | Variable::memorize('system.title', $form->model->get('title')); |
82 | 82 |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | public function body() |
25 | 25 | { |
26 | 26 | $layout = View::addTo($this)->addStyle('max-width:1200px;margin:auto;'); |
27 | - \atk4\ui\Header::addTo($layout, [ __($this->label)]); |
|
27 | + \atk4\ui\Header::addTo($layout, [__($this->label)]); |
|
28 | 28 | $segment = View::addTo($layout, ['ui' => 'segment']); |
29 | 29 | |
30 | 30 | $form = Form::addTo($segment); |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | $logo->setThumbnailSrc(asset('storage/' . self::alias() . '/' . self::$defaultLogo)); |
54 | 54 | }); |
55 | 55 | |
56 | - $logo->onUpload(function ($files) use ($form, $logo) { |
|
56 | + $logo->onUpload(function($files) use ($form, $logo) { |
|
57 | 57 | if ($files === 'error') return $form->error('logo', __('Error uploading image')); |
58 | 58 | |
59 | 59 | $tmpPath = self::alias() . '/tmp/' . $files['name']; |