@@ -30,51 +30,51 @@ discard block |
||
30 | 30 | */ |
31 | 31 | class LayoutView extends ModuleView |
32 | 32 | { |
33 | - /** |
|
34 | - * @var View\NavMenu |
|
35 | - */ |
|
36 | - public $menuLeft; // vertical menu |
|
33 | + /** |
|
34 | + * @var View\NavMenu |
|
35 | + */ |
|
36 | + public $menuLeft; // vertical menu |
|
37 | 37 | |
38 | - /** |
|
39 | - * @var \atk4\ui\Menu |
|
40 | - */ |
|
41 | - public $menu; // horizontal menu |
|
38 | + /** |
|
39 | + * @var \atk4\ui\Menu |
|
40 | + */ |
|
41 | + public $menu; // horizontal menu |
|
42 | 42 | |
43 | - /** |
|
44 | - * @var \atk4\ui\Menu |
|
45 | - */ |
|
46 | - public $menuRight; // vertical pull-down |
|
43 | + /** |
|
44 | + * @var \atk4\ui\Menu |
|
45 | + */ |
|
46 | + public $menuRight; // vertical pull-down |
|
47 | 47 | |
48 | - /** |
|
49 | - * @var View\ActionBar |
|
50 | - */ |
|
51 | - public $actionBar; |
|
52 | - public $locationBar; |
|
48 | + /** |
|
49 | + * @var View\ActionBar |
|
50 | + */ |
|
51 | + public $actionBar; |
|
52 | + public $locationBar; |
|
53 | 53 | |
54 | - public $burger = true; // burger menu item |
|
54 | + public $burger = true; // burger menu item |
|
55 | 55 | |
56 | - /* |
|
56 | + /* |
|
57 | 57 | * Whether or not left Menu is visible on Page load. |
58 | 58 | */ |
59 | - public $isMenuLeftVisible = true; |
|
59 | + public $isMenuLeftVisible = true; |
|
60 | 60 | |
61 | - public $defaultTemplate = 'layout/admin.html'; |
|
61 | + public $defaultTemplate = 'layout/admin.html'; |
|
62 | 62 | |
63 | - protected $location; |
|
63 | + protected $location; |
|
64 | 64 | |
65 | - public function init() |
|
66 | - { |
|
67 | - parent::init(); |
|
65 | + public function init() |
|
66 | + { |
|
67 | + parent::init(); |
|
68 | 68 | |
69 | - $this->setMenu(); |
|
70 | - $this->setActionBar(); |
|
69 | + $this->setMenu(); |
|
70 | + $this->setActionBar(); |
|
71 | 71 | |
72 | 72 | // if (request()->pjax()) return; |
73 | 73 | |
74 | - $this->setMenuLeft(); |
|
75 | - $this->setMenuRight(); |
|
74 | + $this->setMenuLeft(); |
|
75 | + $this->setMenuRight(); |
|
76 | 76 | |
77 | - $this->setVersion(); |
|
77 | + $this->setVersion(); |
|
78 | 78 | |
79 | 79 | // $this->js(true, null, 'body')->niceScroll(); |
80 | 80 | |
@@ -83,25 +83,25 @@ discard block |
||
83 | 83 | // if (event.originalEvent.persisted) { |
84 | 84 | // window.location.reload(); |
85 | 85 | // }')])); |
86 | - } |
|
86 | + } |
|
87 | 87 | |
88 | - public function setMenu() |
|
89 | - { |
|
90 | - if ($this->menu) return; |
|
88 | + public function setMenu() |
|
89 | + { |
|
90 | + if ($this->menu) return; |
|
91 | 91 | |
92 | - $this->menu = $this->add(['Menu', 'atk-topMenu fixed horizontal', 'element' => 'header'], 'TopMenu'); |
|
92 | + $this->menu = $this->add(['Menu', 'atk-topMenu fixed horizontal', 'element' => 'header'], 'TopMenu'); |
|
93 | 93 | |
94 | - // company logo |
|
95 | - // see \Epesi\Core\Controller::logo |
|
96 | - $this->menu->add(['class' => ['epesi-logo'], 'style' => ['width' => '167px']])->add(['Image', url('logo')])->setStyle(['max-height' => '32px']); |
|
94 | + // company logo |
|
95 | + // see \Epesi\Core\Controller::logo |
|
96 | + $this->menu->add(['class' => ['epesi-logo'], 'style' => ['width' => '167px']])->add(['Image', url('logo')])->setStyle(['max-height' => '32px']); |
|
97 | 97 | |
98 | - if ($this->burger) { |
|
99 | - $this->burger = $this->menu->addItem(['class' => ['icon atk-leftMenuTrigger']]); |
|
100 | - } |
|
98 | + if ($this->burger) { |
|
99 | + $this->burger = $this->menu->addItem(['class' => ['icon atk-leftMenuTrigger']]); |
|
100 | + } |
|
101 | 101 | |
102 | 102 | // home icon redirects to /home path |
103 | 103 | // see \Epesi\Core\Controller::home |
104 | - $this->menu->addItem(['class' => ['icon epesi-home']], url('home'))->add(['Icon', 'home']); |
|
104 | + $this->menu->addItem(['class' => ['icon epesi-home']], url('home'))->add(['Icon', 'home']); |
|
105 | 105 | |
106 | 106 | // location bar |
107 | 107 | $this->locationBar = $this->menu->add(['View', ['ui' => 'epesi-location']]); |
@@ -144,52 +144,52 @@ discard block |
||
144 | 144 | ]), 'RightMenu')->addClass('right menu')->removeClass('item'); |
145 | 145 | } |
146 | 146 | |
147 | - public function setMenuLeft() |
|
148 | - { |
|
149 | - if ($this->menuLeft) return; |
|
147 | + public function setMenuLeft() |
|
148 | + { |
|
149 | + if ($this->menuLeft) return; |
|
150 | 150 | |
151 | - $this->menuLeft = View\NavMenu::addTo($this, 'left vertical labeled sidebar', ['LeftMenu']); |
|
151 | + $this->menuLeft = View\NavMenu::addTo($this, 'left vertical labeled sidebar', ['LeftMenu']); |
|
152 | 152 | |
153 | - if (! $this->burger) return; |
|
153 | + if (! $this->burger) return; |
|
154 | 154 | |
155 | - if (! session()->get('menu', 1)) { |
|
156 | - $this->isMenuLeftVisible = false; |
|
157 | - } |
|
155 | + if (! session()->get('menu', 1)) { |
|
156 | + $this->isMenuLeftVisible = false; |
|
157 | + } |
|
158 | 158 | |
159 | - $this->burger->add(['Icon', 'content'])->on('click', [ |
|
160 | - (new jQuery('.ui.left.sidebar'))->toggleClass('visible'), |
|
161 | - (new jQuery('.epesi-logo'))->toggleClass('expanded'), |
|
162 | - (new jQuery('body'))->toggleClass('atk-leftMenu-visible'), |
|
163 | - $this->burger->add('jsCallback')->set(function($j, $visible) { |
|
164 | - session()->put('menu', $visible? 1: 0); |
|
165 | - session()->save(); |
|
166 | - }, [new \atk4\ui\jsExpression( '$("#' . $this->menuLeft->id . '").hasClass("visible")? 1: 0' )]) |
|
167 | - ]); |
|
168 | - } |
|
159 | + $this->burger->add(['Icon', 'content'])->on('click', [ |
|
160 | + (new jQuery('.ui.left.sidebar'))->toggleClass('visible'), |
|
161 | + (new jQuery('.epesi-logo'))->toggleClass('expanded'), |
|
162 | + (new jQuery('body'))->toggleClass('atk-leftMenu-visible'), |
|
163 | + $this->burger->add('jsCallback')->set(function($j, $visible) { |
|
164 | + session()->put('menu', $visible? 1: 0); |
|
165 | + session()->save(); |
|
166 | + }, [new \atk4\ui\jsExpression( '$("#' . $this->menuLeft->id . '").hasClass("visible")? 1: 0' )]) |
|
167 | + ]); |
|
168 | + } |
|
169 | 169 | |
170 | - public function setActionBar() |
|
171 | - { |
|
172 | - if ($this->actionBar) return; |
|
170 | + public function setActionBar() |
|
171 | + { |
|
172 | + if ($this->actionBar) return; |
|
173 | 173 | |
174 | - $this->actionBar = View\ActionBar::addTo($this, [], ['ActionBar']); |
|
174 | + $this->actionBar = View\ActionBar::addTo($this, [], ['ActionBar']); |
|
175 | 175 | |
176 | - return $this; |
|
177 | - } |
|
176 | + return $this; |
|
177 | + } |
|
178 | 178 | |
179 | - public function setVersion() |
|
180 | - { |
|
181 | - $this->template->trySet('version', $this->app->version); |
|
182 | - } |
|
179 | + public function setVersion() |
|
180 | + { |
|
181 | + $this->template->trySet('version', $this->app->version); |
|
182 | + } |
|
183 | 183 | |
184 | - /** |
|
185 | - * {@inheritdoc} |
|
186 | - */ |
|
184 | + /** |
|
185 | + * {@inheritdoc} |
|
186 | + */ |
|
187 | 187 | |
188 | - public function renderView() |
|
189 | - { |
|
190 | - if ($this->menuLeft && $this->isMenuLeftVisible) { |
|
191 | - $this->menuLeft->addClass('visible'); |
|
192 | - } |
|
193 | - parent::renderView(); |
|
194 | - } |
|
188 | + public function renderView() |
|
189 | + { |
|
190 | + if ($this->menuLeft && $this->isMenuLeftVisible) { |
|
191 | + $this->menuLeft->addClass('visible'); |
|
192 | + } |
|
193 | + parent::renderView(); |
|
194 | + } |
|
195 | 195 | } |
@@ -33,17 +33,17 @@ discard block |
||
33 | 33 | /** |
34 | 34 | * @var View\NavMenu |
35 | 35 | */ |
36 | - public $menuLeft; // vertical menu |
|
36 | + public $menuLeft; // vertical menu |
|
37 | 37 | |
38 | 38 | /** |
39 | 39 | * @var \atk4\ui\Menu |
40 | 40 | */ |
41 | - public $menu; // horizontal menu |
|
41 | + public $menu; // horizontal menu |
|
42 | 42 | |
43 | 43 | /** |
44 | 44 | * @var \atk4\ui\Menu |
45 | 45 | */ |
46 | - public $menuRight; // vertical pull-down |
|
46 | + public $menuRight; // vertical pull-down |
|
47 | 47 | |
48 | 48 | /** |
49 | 49 | * @var View\ActionBar |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | public $actionBar; |
52 | 52 | public $locationBar; |
53 | 53 | |
54 | - public $burger = true; // burger menu item |
|
54 | + public $burger = true; // burger menu item |
|
55 | 55 | |
56 | 56 | /* |
57 | 57 | * Whether or not left Menu is visible on Page load. |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | $this->menu->addItem(['class' => ['icon epesi-home']], url('home'))->add(['Icon', 'home']); |
105 | 105 | |
106 | 106 | // location bar |
107 | - $this->locationBar = $this->menu->add(['View', ['ui' => 'epesi-location']]); |
|
107 | + $this->locationBar = $this->menu->add(['View', ['ui' => 'epesi-location']]); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | public function setLocation($crumbs) |
@@ -150,20 +150,20 @@ discard block |
||
150 | 150 | |
151 | 151 | $this->menuLeft = View\NavMenu::addTo($this, 'left vertical labeled sidebar', ['LeftMenu']); |
152 | 152 | |
153 | - if (! $this->burger) return; |
|
153 | + if (!$this->burger) return; |
|
154 | 154 | |
155 | - if (! session()->get('menu', 1)) { |
|
155 | + if (!session()->get('menu', 1)) { |
|
156 | 156 | $this->isMenuLeftVisible = false; |
157 | 157 | } |
158 | 158 | |
159 | - $this->burger->add(['Icon', 'content'])->on('click', [ |
|
159 | + $this->burger->add(['Icon', 'content'])->on('click', [ |
|
160 | 160 | (new jQuery('.ui.left.sidebar'))->toggleClass('visible'), |
161 | 161 | (new jQuery('.epesi-logo'))->toggleClass('expanded'), |
162 | 162 | (new jQuery('body'))->toggleClass('atk-leftMenu-visible'), |
163 | 163 | $this->burger->add('jsCallback')->set(function($j, $visible) { |
164 | - session()->put('menu', $visible? 1: 0); |
|
164 | + session()->put('menu', $visible ? 1 : 0); |
|
165 | 165 | session()->save(); |
166 | - }, [new \atk4\ui\jsExpression( '$("#' . $this->menuLeft->id . '").hasClass("visible")? 1: 0' )]) |
|
166 | + }, [new \atk4\ui\jsExpression('$("#' . $this->menuLeft->id . '").hasClass("visible")? 1: 0')]) |
|
167 | 167 | ]); |
168 | 168 | } |
169 | 169 |
@@ -87,7 +87,9 @@ discard block |
||
87 | 87 | |
88 | 88 | public function setMenu() |
89 | 89 | { |
90 | - if ($this->menu) return; |
|
90 | + if ($this->menu) { |
|
91 | + return; |
|
92 | + } |
|
91 | 93 | |
92 | 94 | $this->menu = $this->add(['Menu', 'atk-topMenu fixed horizontal', 'element' => 'header'], 'TopMenu'); |
93 | 95 | |
@@ -137,7 +139,9 @@ discard block |
||
137 | 139 | |
138 | 140 | public function setMenuRight() |
139 | 141 | { |
140 | - if ($this->menuRight) return; |
|
142 | + if ($this->menuRight) { |
|
143 | + return; |
|
144 | + } |
|
141 | 145 | |
142 | 146 | $this->menuRight = $this->menu->add(new View\RightMenu([ |
143 | 147 | 'ui' => false |
@@ -146,11 +150,15 @@ discard block |
||
146 | 150 | |
147 | 151 | public function setMenuLeft() |
148 | 152 | { |
149 | - if ($this->menuLeft) return; |
|
153 | + if ($this->menuLeft) { |
|
154 | + return; |
|
155 | + } |
|
150 | 156 | |
151 | 157 | $this->menuLeft = View\NavMenu::addTo($this, 'left vertical labeled sidebar', ['LeftMenu']); |
152 | 158 | |
153 | - if (! $this->burger) return; |
|
159 | + if (! $this->burger) { |
|
160 | + return; |
|
161 | + } |
|
154 | 162 | |
155 | 163 | if (! session()->get('menu', 1)) { |
156 | 164 | $this->isMenuLeftVisible = false; |
@@ -169,7 +177,9 @@ discard block |
||
169 | 177 | |
170 | 178 | public function setActionBar() |
171 | 179 | { |
172 | - if ($this->actionBar) return; |
|
180 | + if ($this->actionBar) { |
|
181 | + return; |
|
182 | + } |
|
173 | 183 | |
174 | 184 | $this->actionBar = View\ActionBar::addTo($this, [], ['ActionBar']); |
175 | 185 |
@@ -7,22 +7,22 @@ |
||
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 | - * @param \Illuminate\Database\DatabaseManager $db The Laravel database manager |
|
14 | - * |
|
15 | - * @return \atk4\data\Persistence_SQL |
|
16 | - * @throws \atk4\data\Exception |
|
17 | - * @throws \atk4\dsql\Exception |
|
18 | - */ |
|
19 | - public function __construct(DatabaseManager $database) |
|
20 | - { |
|
21 | - $pdo = $database->connection()->getPdo(); |
|
10 | + /** |
|
11 | + * Take a laravel connection and pass it to ATK Data |
|
12 | + * |
|
13 | + * @param \Illuminate\Database\DatabaseManager $db The Laravel database manager |
|
14 | + * |
|
15 | + * @return \atk4\data\Persistence_SQL |
|
16 | + * @throws \atk4\data\Exception |
|
17 | + * @throws \atk4\dsql\Exception |
|
18 | + */ |
|
19 | + public function __construct(DatabaseManager $database) |
|
20 | + { |
|
21 | + $pdo = $database->connection()->getPdo(); |
|
22 | 22 | |
23 | - // temporary fix of atk4/data inability to handle PREPARE on 'is null' |
|
24 | - $pdo->setAttribute(\PDO::ATTR_EMULATE_PREPARES, true); |
|
23 | + // temporary fix of atk4/data inability to handle PREPARE on 'is null' |
|
24 | + $pdo->setAttribute(\PDO::ATTR_EMULATE_PREPARES, true); |
|
25 | 25 | |
26 | - parent::__construct(Connection::connect($pdo)); |
|
27 | - } |
|
26 | + parent::__construct(Connection::connect($pdo)); |
|
27 | + } |
|
28 | 28 | } |