@@ -36,13 +36,13 @@ |
||
36 | 36 | return $this; |
37 | 37 | } |
38 | 38 | |
39 | - $this->label = is_array($this->label)? $this->label: [$this->label]; |
|
39 | + $this->label = is_array($this->label) ? $this->label : [$this->label]; |
|
40 | 40 | |
41 | 41 | $this->label = array_map('trans', $this->label); |
42 | 42 | |
43 | - $this->location = is_array($this->location)? $this->location: [$this->location]; |
|
43 | + $this->location = is_array($this->location) ? $this->location : [$this->location]; |
|
44 | 44 | |
45 | - return array_merge($this->label, $this->location?: []); |
|
45 | + return array_merge($this->label, $this->location ?: []); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | public function label($label) |
@@ -34,10 +34,10 @@ |
||
34 | 34 | */ |
35 | 35 | final public function displayModuleContent($method, $args) { |
36 | 36 | // if method not callbale abort to 'not found' |
37 | - if (! is_callable([$this, $method])) abort(404); |
|
37 | + if (!is_callable([$this, $method])) abort(404); |
|
38 | 38 | |
39 | 39 | // if user has no access abort 'no access' |
40 | - if (! $this->access()) abort(401); |
|
40 | + if (!$this->access()) abort(401); |
|
41 | 41 | |
42 | 42 | $args = $this->decodeArgs($args); |
43 | 43 |
@@ -34,10 +34,14 @@ |
||
34 | 34 | */ |
35 | 35 | final public function displayModuleContent($method, $args) { |
36 | 36 | // if method not callbale abort to 'not found' |
37 | - if (! is_callable([$this, $method])) abort(404); |
|
37 | + if (! is_callable([$this, $method])) { |
|
38 | + abort(404); |
|
39 | + } |
|
38 | 40 | |
39 | 41 | // if user has no access abort 'no access' |
40 | - if (! $this->access()) abort(401); |
|
42 | + if (! $this->access()) { |
|
43 | + abort(401); |
|
44 | + } |
|
41 | 45 | |
42 | 46 | $args = $this->decodeArgs($args); |
43 | 47 |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | */ |
30 | 30 | $joint = new $class(); |
31 | 31 | |
32 | - if (! $joint->access()) continue; |
|
32 | + if (!$joint->access()) continue; |
|
33 | 33 | |
34 | 34 | $ret->add($joint); |
35 | 35 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | |
70 | 70 | final public static function packageManifest() |
71 | 71 | { |
72 | - return self::$packageManifest = self::$packageManifest?: new PackageManifest(new Filesystem(), app()->basePath(), self::getCachedManifestPath()); |
|
72 | + return self::$packageManifest = self::$packageManifest ?: new PackageManifest(new Filesystem(), app()->basePath(), self::getCachedManifestPath()); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | final public static function getCachedManifestPath() |
@@ -29,7 +29,9 @@ |
||
29 | 29 | */ |
30 | 30 | $joint = new $class(); |
31 | 31 | |
32 | - if (! $joint->access()) continue; |
|
32 | + if (! $joint->access()) { |
|
33 | + continue; |
|
34 | + } |
|
33 | 35 | |
34 | 36 | $ret->add($joint); |
35 | 37 | } |
@@ -2,35 +2,35 @@ |
||
2 | 2 | |
3 | 3 | if (! function_exists('epesi')) { |
4 | 4 | function epesi() : Epesi\Core\App |
5 | - { |
|
6 | - return resolve(Epesi\Core\App::class); |
|
7 | - } |
|
5 | + { |
|
6 | + return resolve(Epesi\Core\App::class); |
|
7 | + } |
|
8 | 8 | } |
9 | 9 | |
10 | 10 | if (! function_exists('eval_css')) { |
11 | 11 | function eval_css($css) |
12 | - { |
|
13 | - epesi()->addStyle($css); |
|
14 | - } |
|
12 | + { |
|
13 | + epesi()->addStyle($css); |
|
14 | + } |
|
15 | 15 | } |
16 | 16 | |
17 | 17 | if (! function_exists('eval_js')) { |
18 | 18 | function eval_js($js, $args = []) |
19 | - { |
|
20 | - epesi()->addJS($js, $args); |
|
21 | - } |
|
19 | + { |
|
20 | + epesi()->addJS($js, $args); |
|
21 | + } |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | if (! function_exists('load_css')) { |
25 | 25 | function load_css($url) |
26 | - { |
|
27 | - return epesi()->requireCSS($url); |
|
28 | - } |
|
26 | + { |
|
27 | + return epesi()->requireCSS($url); |
|
28 | + } |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | if (! function_exists('load_js')) { |
32 | 32 | function load_js($url) |
33 | - { |
|
34 | - return epesi()->requireJS($url); |
|
35 | - } |
|
33 | + { |
|
34 | + return epesi()->requireJS($url); |
|
35 | + } |
|
36 | 36 | } |
@@ -1,34 +1,34 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (! function_exists('epesi')) { |
|
3 | +if (!function_exists('epesi')) { |
|
4 | 4 | function epesi() : Epesi\Core\App |
5 | 5 | { |
6 | 6 | return resolve(Epesi\Core\App::class); |
7 | 7 | } |
8 | 8 | } |
9 | 9 | |
10 | -if (! function_exists('eval_css')) { |
|
10 | +if (!function_exists('eval_css')) { |
|
11 | 11 | function eval_css($css) |
12 | 12 | { |
13 | 13 | epesi()->addStyle($css); |
14 | 14 | } |
15 | 15 | } |
16 | 16 | |
17 | -if (! function_exists('eval_js')) { |
|
17 | +if (!function_exists('eval_js')) { |
|
18 | 18 | function eval_js($js, $args = []) |
19 | 19 | { |
20 | 20 | epesi()->addJS($js, $args); |
21 | 21 | } |
22 | 22 | } |
23 | 23 | |
24 | -if (! function_exists('load_css')) { |
|
24 | +if (!function_exists('load_css')) { |
|
25 | 25 | function load_css($url) |
26 | 26 | { |
27 | 27 | return epesi()->requireCSS($url); |
28 | 28 | } |
29 | 29 | } |
30 | 30 | |
31 | -if (! function_exists('load_js')) { |
|
31 | +if (!function_exists('load_js')) { |
|
32 | 32 | function load_js($url) |
33 | 33 | { |
34 | 34 | return epesi()->requireJS($url); |
@@ -7,166 +7,166 @@ |
||
7 | 7 | |
8 | 8 | class PackageManifest |
9 | 9 | { |
10 | - /** |
|
11 | - * The filesystem instance. |
|
12 | - * |
|
13 | - * @var \Illuminate\Filesystem\Filesystem |
|
14 | - */ |
|
15 | - public $files; |
|
16 | - |
|
17 | - /** |
|
18 | - * The base path. |
|
19 | - * |
|
20 | - * @var string |
|
21 | - */ |
|
22 | - public $basePath; |
|
23 | - |
|
24 | - /** |
|
25 | - * The vendor path. |
|
26 | - * |
|
27 | - * @var string |
|
28 | - */ |
|
29 | - public $vendorPath; |
|
30 | - |
|
31 | - /** |
|
32 | - * The manifest path. |
|
33 | - * |
|
34 | - * @var string|null |
|
35 | - */ |
|
36 | - public $manifestPath; |
|
37 | - |
|
38 | - /** |
|
39 | - * The loaded manifest array. |
|
40 | - * |
|
41 | - * @var array |
|
42 | - */ |
|
43 | - public $manifest; |
|
44 | - |
|
45 | - /** |
|
46 | - * Create a new package manifest instance. |
|
47 | - * |
|
48 | - * @param \Illuminate\Filesystem\Filesystem $files |
|
49 | - * @param string $basePath |
|
50 | - * @param string $manifestPath |
|
51 | - * @return void |
|
52 | - */ |
|
53 | - public function __construct(Filesystem $files, $basePath, $manifestPath) |
|
54 | - { |
|
55 | - $this->files = $files; |
|
56 | - $this->basePath = $basePath; |
|
57 | - $this->manifestPath = $manifestPath; |
|
58 | - $this->vendorPath = $basePath.'/vendor'; |
|
59 | - } |
|
60 | - |
|
61 | - /** |
|
62 | - * Get all of the integrator class names for all packages. |
|
63 | - * |
|
64 | - * @return array |
|
65 | - */ |
|
66 | - public function joints() |
|
67 | - { |
|
68 | - return collect($this->getManifest())->flatMap(function ($configuration) { |
|
69 | - return (array) ($configuration['joints'] ?? []); |
|
70 | - })->filter()->all(); |
|
71 | - } |
|
10 | + /** |
|
11 | + * The filesystem instance. |
|
12 | + * |
|
13 | + * @var \Illuminate\Filesystem\Filesystem |
|
14 | + */ |
|
15 | + public $files; |
|
16 | + |
|
17 | + /** |
|
18 | + * The base path. |
|
19 | + * |
|
20 | + * @var string |
|
21 | + */ |
|
22 | + public $basePath; |
|
23 | + |
|
24 | + /** |
|
25 | + * The vendor path. |
|
26 | + * |
|
27 | + * @var string |
|
28 | + */ |
|
29 | + public $vendorPath; |
|
30 | + |
|
31 | + /** |
|
32 | + * The manifest path. |
|
33 | + * |
|
34 | + * @var string|null |
|
35 | + */ |
|
36 | + public $manifestPath; |
|
37 | + |
|
38 | + /** |
|
39 | + * The loaded manifest array. |
|
40 | + * |
|
41 | + * @var array |
|
42 | + */ |
|
43 | + public $manifest; |
|
44 | + |
|
45 | + /** |
|
46 | + * Create a new package manifest instance. |
|
47 | + * |
|
48 | + * @param \Illuminate\Filesystem\Filesystem $files |
|
49 | + * @param string $basePath |
|
50 | + * @param string $manifestPath |
|
51 | + * @return void |
|
52 | + */ |
|
53 | + public function __construct(Filesystem $files, $basePath, $manifestPath) |
|
54 | + { |
|
55 | + $this->files = $files; |
|
56 | + $this->basePath = $basePath; |
|
57 | + $this->manifestPath = $manifestPath; |
|
58 | + $this->vendorPath = $basePath.'/vendor'; |
|
59 | + } |
|
60 | + |
|
61 | + /** |
|
62 | + * Get all of the integrator class names for all packages. |
|
63 | + * |
|
64 | + * @return array |
|
65 | + */ |
|
66 | + public function joints() |
|
67 | + { |
|
68 | + return collect($this->getManifest())->flatMap(function ($configuration) { |
|
69 | + return (array) ($configuration['joints'] ?? []); |
|
70 | + })->filter()->all(); |
|
71 | + } |
|
72 | 72 | |
73 | - /** |
|
74 | - * Get all of the module root folders for all packages. |
|
75 | - * |
|
76 | - * @return array |
|
77 | - */ |
|
78 | - public function modules() |
|
79 | - { |
|
80 | - return collect($this->getManifest())->flatMap(function ($configuration) { |
|
81 | - return (array) ($configuration['modules'] ?? []); |
|
82 | - })->filter()->all(); |
|
83 | - } |
|
84 | - |
|
85 | - /** |
|
86 | - * Get the current package manifest. |
|
87 | - * |
|
88 | - * @return array |
|
89 | - */ |
|
90 | - protected function getManifest() |
|
91 | - { |
|
92 | - if (isset($this->manifest)) { |
|
93 | - return $this->manifest; |
|
94 | - } |
|
95 | - |
|
96 | - if (! file_exists($this->manifestPath)) { |
|
97 | - $this->build(); |
|
98 | - } |
|
73 | + /** |
|
74 | + * Get all of the module root folders for all packages. |
|
75 | + * |
|
76 | + * @return array |
|
77 | + */ |
|
78 | + public function modules() |
|
79 | + { |
|
80 | + return collect($this->getManifest())->flatMap(function ($configuration) { |
|
81 | + return (array) ($configuration['modules'] ?? []); |
|
82 | + })->filter()->all(); |
|
83 | + } |
|
84 | + |
|
85 | + /** |
|
86 | + * Get the current package manifest. |
|
87 | + * |
|
88 | + * @return array |
|
89 | + */ |
|
90 | + protected function getManifest() |
|
91 | + { |
|
92 | + if (isset($this->manifest)) { |
|
93 | + return $this->manifest; |
|
94 | + } |
|
95 | + |
|
96 | + if (! file_exists($this->manifestPath)) { |
|
97 | + $this->build(); |
|
98 | + } |
|
99 | 99 | |
100 | - return $this->manifest = file_exists($this->manifestPath) ? |
|
101 | - $this->files->getRequire($this->manifestPath) : []; |
|
102 | - } |
|
103 | - |
|
104 | - /** |
|
105 | - * Build the manifest and write it to disk. |
|
106 | - * |
|
107 | - * @return void |
|
108 | - */ |
|
109 | - public function build() |
|
110 | - { |
|
111 | - $packages = []; |
|
112 | - |
|
113 | - if ($this->files->exists($path = $this->vendorPath.'/composer/installed.json')) { |
|
114 | - $packages = json_decode($this->files->get($path), true); |
|
115 | - } |
|
116 | - |
|
117 | - $ignoreAll = in_array('*', $ignore = $this->packagesToIgnore()); |
|
118 | - |
|
119 | - $this->write(collect($packages)->mapWithKeys(function ($package) { |
|
120 | - return [$this->format($package['name']) => $package['extra']['epesi'] ?? []]; |
|
121 | - })->each(function ($configuration) use (&$ignore) { |
|
122 | - $ignore = array_merge($ignore, $configuration['dont-discover'] ?? []); |
|
123 | - })->reject(function ($configuration, $package) use ($ignore, $ignoreAll) { |
|
124 | - return $ignoreAll || in_array($package, $ignore); |
|
125 | - })->filter()->all()); |
|
126 | - } |
|
127 | - |
|
128 | - /** |
|
129 | - * Format the given package name. |
|
130 | - * |
|
131 | - * @param string $package |
|
132 | - * @return string |
|
133 | - */ |
|
134 | - protected function format($package) |
|
135 | - { |
|
136 | - return str_replace($this->vendorPath.'/', '', $package); |
|
137 | - } |
|
138 | - |
|
139 | - /** |
|
140 | - * Get all of the package names that should be ignored. |
|
141 | - * |
|
142 | - * @return array |
|
143 | - */ |
|
144 | - protected function packagesToIgnore() |
|
145 | - { |
|
146 | - if (! file_exists($this->basePath.'/composer.json')) { |
|
147 | - return []; |
|
148 | - } |
|
149 | - |
|
150 | - return json_decode(file_get_contents( |
|
151 | - $this->basePath.'/composer.json' |
|
152 | - ), true)['extra']['epesi']['dont-discover'] ?? []; |
|
153 | - } |
|
154 | - |
|
155 | - /** |
|
156 | - * Write the given manifest array to disk. |
|
157 | - * |
|
158 | - * @param array $manifest |
|
159 | - * @return void |
|
160 | - * @throws \Exception |
|
161 | - */ |
|
162 | - protected function write(array $manifest) |
|
163 | - { |
|
164 | - if (! is_writable(dirname($this->manifestPath))) { |
|
165 | - throw new Exception('The '.dirname($this->manifestPath).' directory must be present and writable.'); |
|
166 | - } |
|
167 | - |
|
168 | - $this->files->put( |
|
169 | - $this->manifestPath, '<?php return '.var_export($manifest, true).';' |
|
170 | - ); |
|
171 | - } |
|
100 | + return $this->manifest = file_exists($this->manifestPath) ? |
|
101 | + $this->files->getRequire($this->manifestPath) : []; |
|
102 | + } |
|
103 | + |
|
104 | + /** |
|
105 | + * Build the manifest and write it to disk. |
|
106 | + * |
|
107 | + * @return void |
|
108 | + */ |
|
109 | + public function build() |
|
110 | + { |
|
111 | + $packages = []; |
|
112 | + |
|
113 | + if ($this->files->exists($path = $this->vendorPath.'/composer/installed.json')) { |
|
114 | + $packages = json_decode($this->files->get($path), true); |
|
115 | + } |
|
116 | + |
|
117 | + $ignoreAll = in_array('*', $ignore = $this->packagesToIgnore()); |
|
118 | + |
|
119 | + $this->write(collect($packages)->mapWithKeys(function ($package) { |
|
120 | + return [$this->format($package['name']) => $package['extra']['epesi'] ?? []]; |
|
121 | + })->each(function ($configuration) use (&$ignore) { |
|
122 | + $ignore = array_merge($ignore, $configuration['dont-discover'] ?? []); |
|
123 | + })->reject(function ($configuration, $package) use ($ignore, $ignoreAll) { |
|
124 | + return $ignoreAll || in_array($package, $ignore); |
|
125 | + })->filter()->all()); |
|
126 | + } |
|
127 | + |
|
128 | + /** |
|
129 | + * Format the given package name. |
|
130 | + * |
|
131 | + * @param string $package |
|
132 | + * @return string |
|
133 | + */ |
|
134 | + protected function format($package) |
|
135 | + { |
|
136 | + return str_replace($this->vendorPath.'/', '', $package); |
|
137 | + } |
|
138 | + |
|
139 | + /** |
|
140 | + * Get all of the package names that should be ignored. |
|
141 | + * |
|
142 | + * @return array |
|
143 | + */ |
|
144 | + protected function packagesToIgnore() |
|
145 | + { |
|
146 | + if (! file_exists($this->basePath.'/composer.json')) { |
|
147 | + return []; |
|
148 | + } |
|
149 | + |
|
150 | + return json_decode(file_get_contents( |
|
151 | + $this->basePath.'/composer.json' |
|
152 | + ), true)['extra']['epesi']['dont-discover'] ?? []; |
|
153 | + } |
|
154 | + |
|
155 | + /** |
|
156 | + * Write the given manifest array to disk. |
|
157 | + * |
|
158 | + * @param array $manifest |
|
159 | + * @return void |
|
160 | + * @throws \Exception |
|
161 | + */ |
|
162 | + protected function write(array $manifest) |
|
163 | + { |
|
164 | + if (! is_writable(dirname($this->manifestPath))) { |
|
165 | + throw new Exception('The '.dirname($this->manifestPath).' directory must be present and writable.'); |
|
166 | + } |
|
167 | + |
|
168 | + $this->files->put( |
|
169 | + $this->manifestPath, '<?php return '.var_export($manifest, true).';' |
|
170 | + ); |
|
171 | + } |
|
172 | 172 | } |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | $this->files = $files; |
56 | 56 | $this->basePath = $basePath; |
57 | 57 | $this->manifestPath = $manifestPath; |
58 | - $this->vendorPath = $basePath.'/vendor'; |
|
58 | + $this->vendorPath = $basePath . '/vendor'; |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | */ |
66 | 66 | public function joints() |
67 | 67 | { |
68 | - return collect($this->getManifest())->flatMap(function ($configuration) { |
|
68 | + return collect($this->getManifest())->flatMap(function($configuration) { |
|
69 | 69 | return (array) ($configuration['joints'] ?? []); |
70 | 70 | })->filter()->all(); |
71 | 71 | } |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | */ |
78 | 78 | public function modules() |
79 | 79 | { |
80 | - return collect($this->getManifest())->flatMap(function ($configuration) { |
|
80 | + return collect($this->getManifest())->flatMap(function($configuration) { |
|
81 | 81 | return (array) ($configuration['modules'] ?? []); |
82 | 82 | })->filter()->all(); |
83 | 83 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | return $this->manifest; |
94 | 94 | } |
95 | 95 | |
96 | - if (! file_exists($this->manifestPath)) { |
|
96 | + if (!file_exists($this->manifestPath)) { |
|
97 | 97 | $this->build(); |
98 | 98 | } |
99 | 99 | |
@@ -110,17 +110,17 @@ discard block |
||
110 | 110 | { |
111 | 111 | $packages = []; |
112 | 112 | |
113 | - if ($this->files->exists($path = $this->vendorPath.'/composer/installed.json')) { |
|
113 | + if ($this->files->exists($path = $this->vendorPath . '/composer/installed.json')) { |
|
114 | 114 | $packages = json_decode($this->files->get($path), true); |
115 | 115 | } |
116 | 116 | |
117 | 117 | $ignoreAll = in_array('*', $ignore = $this->packagesToIgnore()); |
118 | 118 | |
119 | - $this->write(collect($packages)->mapWithKeys(function ($package) { |
|
119 | + $this->write(collect($packages)->mapWithKeys(function($package) { |
|
120 | 120 | return [$this->format($package['name']) => $package['extra']['epesi'] ?? []]; |
121 | - })->each(function ($configuration) use (&$ignore) { |
|
121 | + })->each(function($configuration) use (&$ignore) { |
|
122 | 122 | $ignore = array_merge($ignore, $configuration['dont-discover'] ?? []); |
123 | - })->reject(function ($configuration, $package) use ($ignore, $ignoreAll) { |
|
123 | + })->reject(function($configuration, $package) use ($ignore, $ignoreAll) { |
|
124 | 124 | return $ignoreAll || in_array($package, $ignore); |
125 | 125 | })->filter()->all()); |
126 | 126 | } |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | */ |
134 | 134 | protected function format($package) |
135 | 135 | { |
136 | - return str_replace($this->vendorPath.'/', '', $package); |
|
136 | + return str_replace($this->vendorPath . '/', '', $package); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | /** |
@@ -143,12 +143,12 @@ discard block |
||
143 | 143 | */ |
144 | 144 | protected function packagesToIgnore() |
145 | 145 | { |
146 | - if (! file_exists($this->basePath.'/composer.json')) { |
|
146 | + if (!file_exists($this->basePath . '/composer.json')) { |
|
147 | 147 | return []; |
148 | 148 | } |
149 | 149 | |
150 | 150 | return json_decode(file_get_contents( |
151 | - $this->basePath.'/composer.json' |
|
151 | + $this->basePath . '/composer.json' |
|
152 | 152 | ), true)['extra']['epesi']['dont-discover'] ?? []; |
153 | 153 | } |
154 | 154 | |
@@ -161,12 +161,12 @@ discard block |
||
161 | 161 | */ |
162 | 162 | protected function write(array $manifest) |
163 | 163 | { |
164 | - if (! is_writable(dirname($this->manifestPath))) { |
|
165 | - throw new Exception('The '.dirname($this->manifestPath).' directory must be present and writable.'); |
|
164 | + if (!is_writable(dirname($this->manifestPath))) { |
|
165 | + throw new Exception('The ' . dirname($this->manifestPath) . ' directory must be present and writable.'); |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | $this->files->put( |
169 | - $this->manifestPath, '<?php return '.var_export($manifest, true).';' |
|
169 | + $this->manifestPath, '<?php return ' . var_export($manifest, true) . ';' |
|
170 | 170 | ); |
171 | 171 | } |
172 | 172 | } |
@@ -31,36 +31,36 @@ discard block |
||
31 | 31 | */ |
32 | 32 | class AdminLayout extends Generic |
33 | 33 | { |
34 | - public $menuLeft; // vertical menu |
|
35 | - public $menu; // horizontal menu |
|
36 | - public $menuRight; // vertical pull-down |
|
37 | - public $actionBar; |
|
38 | - public $locationBar; |
|
34 | + public $menuLeft; // vertical menu |
|
35 | + public $menu; // horizontal menu |
|
36 | + public $menuRight; // vertical pull-down |
|
37 | + public $actionBar; |
|
38 | + public $locationBar; |
|
39 | 39 | |
40 | - public $burger = true; // burger menu item |
|
40 | + public $burger = true; // burger menu item |
|
41 | 41 | |
42 | - /* |
|
42 | + /* |
|
43 | 43 | * Whether or not left Menu is visible on Page load. |
44 | 44 | */ |
45 | - public $isMenuLeftVisible = true; |
|
45 | + public $isMenuLeftVisible = true; |
|
46 | 46 | |
47 | - public $defaultTemplate = 'layout/admin.html'; |
|
47 | + public $defaultTemplate = 'layout/admin.html'; |
|
48 | 48 | |
49 | - protected $location; |
|
49 | + protected $location; |
|
50 | 50 | |
51 | - public function init() |
|
52 | - { |
|
53 | - parent::init(); |
|
51 | + public function init() |
|
52 | + { |
|
53 | + parent::init(); |
|
54 | 54 | |
55 | - $this->setMenu(); |
|
56 | - $this->setActionBar(); |
|
55 | + $this->setMenu(); |
|
56 | + $this->setActionBar(); |
|
57 | 57 | |
58 | 58 | // if (request()->pjax()) return; |
59 | 59 | |
60 | - $this->setMenuLeft(); |
|
61 | - $this->setMenuRight(); |
|
60 | + $this->setMenuLeft(); |
|
61 | + $this->setMenuRight(); |
|
62 | 62 | |
63 | - $this->setVersion(); |
|
63 | + $this->setVersion(); |
|
64 | 64 | |
65 | 65 | // $this->js(true, null, 'body')->niceScroll(); |
66 | 66 | // $this->js(true, null, new jsExpression('window'))->on('pageshow', new jsFunction(['event'], [ |
@@ -68,24 +68,24 @@ discard block |
||
68 | 68 | // if (event.originalEvent.persisted) { |
69 | 69 | // window.location.reload(); |
70 | 70 | // }')])); |
71 | - } |
|
71 | + } |
|
72 | 72 | |
73 | - public function setMenu() |
|
74 | - { |
|
75 | - if ($this->menu) return; |
|
73 | + public function setMenu() |
|
74 | + { |
|
75 | + if ($this->menu) return; |
|
76 | 76 | |
77 | - //.ui.sidebar, |
|
78 | - $this->menu = $this->add(['Menu', 'atk-topMenu fixed horizontal', 'element' => 'header'], 'TopMenu'); |
|
77 | + //.ui.sidebar, |
|
78 | + $this->menu = $this->add(['Menu', 'atk-topMenu fixed horizontal', 'element' => 'header'], 'TopMenu'); |
|
79 | 79 | |
80 | - $this->app->addStyle(''); |
|
80 | + $this->app->addStyle(''); |
|
81 | 81 | |
82 | - // company logo |
|
83 | - $this->menu->add(['class' => ['epesi-logo']])->add(['Image', url('img/tsm_logo_agile.png')]); |
|
82 | + // company logo |
|
83 | + $this->menu->add(['class' => ['epesi-logo']])->add(['Image', url('img/tsm_logo_agile.png')]); |
|
84 | 84 | |
85 | - if ($this->burger) { |
|
86 | - /** @scrutinizer ignore-call */ |
|
87 | - $this->burger = $this->menu->addItem(['class' => ['icon atk-leftMenuTrigger']]); |
|
88 | - } |
|
85 | + if ($this->burger) { |
|
86 | + /** @scrutinizer ignore-call */ |
|
87 | + $this->burger = $this->menu->addItem(['class' => ['icon atk-leftMenuTrigger']]); |
|
88 | + } |
|
89 | 89 | |
90 | 90 | // home icon |
91 | 91 | $this->menu->addItem(['class' => ['icon epesi-home']], url('view/dashboard'))->add(['Icon', 'home']); |
@@ -127,50 +127,50 @@ discard block |
||
127 | 127 | ]), 'RightMenu')->addClass('right menu')->removeClass('item'); |
128 | 128 | } |
129 | 129 | |
130 | - public function setMenuLeft() |
|
131 | - { |
|
132 | - if ($this->menuLeft) return; |
|
130 | + public function setMenuLeft() |
|
131 | + { |
|
132 | + if ($this->menuLeft) return; |
|
133 | 133 | |
134 | - $this->menuLeft = $this->add(new NavMenu('left vertical labeled sidebar'), 'LeftMenu'); |
|
134 | + $this->menuLeft = $this->add(new NavMenu('left vertical labeled sidebar'), 'LeftMenu'); |
|
135 | 135 | |
136 | - if (! $this->burger) return; |
|
136 | + if (! $this->burger) return; |
|
137 | 137 | |
138 | - if (! session()->get('menu', 1)) { |
|
139 | - $this->isMenuLeftVisible = false; |
|
140 | - } |
|
138 | + if (! session()->get('menu', 1)) { |
|
139 | + $this->isMenuLeftVisible = false; |
|
140 | + } |
|
141 | 141 | |
142 | - $this->burger->add(['Icon', 'content'])->on('click', [ |
|
143 | - (new jQuery('.ui.left.sidebar'))->toggleClass('visible'), |
|
144 | - (new jQuery('.epesi-logo'))->toggleClass('expanded'), |
|
145 | - (new jQuery('body'))->toggleClass('atk-leftMenu-visible'), |
|
146 | - $this->burger->add('jsCallback')->set(function($j, $visible) { |
|
147 | - session()->put('menu', $visible? 1: 0); |
|
148 | - session()->save(); |
|
149 | - }, [new \atk4\ui\jsExpression( '$("#' . $this->menuLeft->id . '").hasClass("visible")? 1: 0' )]) |
|
150 | - ]); |
|
151 | - } |
|
142 | + $this->burger->add(['Icon', 'content'])->on('click', [ |
|
143 | + (new jQuery('.ui.left.sidebar'))->toggleClass('visible'), |
|
144 | + (new jQuery('.epesi-logo'))->toggleClass('expanded'), |
|
145 | + (new jQuery('body'))->toggleClass('atk-leftMenu-visible'), |
|
146 | + $this->burger->add('jsCallback')->set(function($j, $visible) { |
|
147 | + session()->put('menu', $visible? 1: 0); |
|
148 | + session()->save(); |
|
149 | + }, [new \atk4\ui\jsExpression( '$("#' . $this->menuLeft->id . '").hasClass("visible")? 1: 0' )]) |
|
150 | + ]); |
|
151 | + } |
|
152 | 152 | |
153 | - public function setActionBar() |
|
154 | - { |
|
155 | - if ($this->actionBar) return; |
|
153 | + public function setActionBar() |
|
154 | + { |
|
155 | + if ($this->actionBar) return; |
|
156 | 156 | |
157 | - $this->actionBar = $this->add(new ActionBar(), 'ActionBar'); |
|
158 | - } |
|
157 | + $this->actionBar = $this->add(new ActionBar(), 'ActionBar'); |
|
158 | + } |
|
159 | 159 | |
160 | - public function setVersion() |
|
161 | - { |
|
162 | - $this->template->trySet('version', $this->app->version); |
|
163 | - } |
|
160 | + public function setVersion() |
|
161 | + { |
|
162 | + $this->template->trySet('version', $this->app->version); |
|
163 | + } |
|
164 | 164 | |
165 | - /** |
|
166 | - * {@inheritdoc} |
|
167 | - */ |
|
165 | + /** |
|
166 | + * {@inheritdoc} |
|
167 | + */ |
|
168 | 168 | |
169 | - public function renderView() |
|
170 | - { |
|
171 | - if ($this->menuLeft && $this->isMenuLeftVisible) { |
|
172 | - $this->menuLeft->addClass('visible'); |
|
173 | - } |
|
174 | - parent::renderView(); |
|
175 | - } |
|
169 | + public function renderView() |
|
170 | + { |
|
171 | + if ($this->menuLeft && $this->isMenuLeftVisible) { |
|
172 | + $this->menuLeft->addClass('visible'); |
|
173 | + } |
|
174 | + parent::renderView(); |
|
175 | + } |
|
176 | 176 | } |
@@ -31,13 +31,13 @@ discard block |
||
31 | 31 | */ |
32 | 32 | class AdminLayout extends Generic |
33 | 33 | { |
34 | - public $menuLeft; // vertical menu |
|
35 | - public $menu; // horizontal menu |
|
36 | - public $menuRight; // vertical pull-down |
|
34 | + public $menuLeft; // vertical menu |
|
35 | + public $menu; // horizontal menu |
|
36 | + public $menuRight; // vertical pull-down |
|
37 | 37 | public $actionBar; |
38 | 38 | public $locationBar; |
39 | 39 | |
40 | - public $burger = true; // burger menu item |
|
40 | + public $burger = true; // burger menu item |
|
41 | 41 | |
42 | 42 | /* |
43 | 43 | * Whether or not left Menu is visible on Page load. |
@@ -88,10 +88,10 @@ discard block |
||
88 | 88 | } |
89 | 89 | |
90 | 90 | // home icon |
91 | - $this->menu->addItem(['class' => ['icon epesi-home']], url('view/dashboard'))->add(['Icon', 'home']); |
|
91 | + $this->menu->addItem(['class' => ['icon epesi-home']], url('view/dashboard'))->add(['Icon', 'home']); |
|
92 | 92 | |
93 | 93 | // location bar |
94 | - $this->locationBar = $this->menu->add(['View', ['ui' => 'epesi-location']]); |
|
94 | + $this->locationBar = $this->menu->add(['View', ['ui' => 'epesi-location']]); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | public function setLocation($crumbs) |
@@ -133,20 +133,20 @@ discard block |
||
133 | 133 | |
134 | 134 | $this->menuLeft = $this->add(new NavMenu('left vertical labeled sidebar'), 'LeftMenu'); |
135 | 135 | |
136 | - if (! $this->burger) return; |
|
136 | + if (!$this->burger) return; |
|
137 | 137 | |
138 | - if (! session()->get('menu', 1)) { |
|
138 | + if (!session()->get('menu', 1)) { |
|
139 | 139 | $this->isMenuLeftVisible = false; |
140 | 140 | } |
141 | 141 | |
142 | - $this->burger->add(['Icon', 'content'])->on('click', [ |
|
142 | + $this->burger->add(['Icon', 'content'])->on('click', [ |
|
143 | 143 | (new jQuery('.ui.left.sidebar'))->toggleClass('visible'), |
144 | 144 | (new jQuery('.epesi-logo'))->toggleClass('expanded'), |
145 | 145 | (new jQuery('body'))->toggleClass('atk-leftMenu-visible'), |
146 | 146 | $this->burger->add('jsCallback')->set(function($j, $visible) { |
147 | - session()->put('menu', $visible? 1: 0); |
|
147 | + session()->put('menu', $visible ? 1 : 0); |
|
148 | 148 | session()->save(); |
149 | - }, [new \atk4\ui\jsExpression( '$("#' . $this->menuLeft->id . '").hasClass("visible")? 1: 0' )]) |
|
149 | + }, [new \atk4\ui\jsExpression('$("#' . $this->menuLeft->id . '").hasClass("visible")? 1: 0')]) |
|
150 | 150 | ]); |
151 | 151 | } |
152 | 152 |
@@ -72,7 +72,9 @@ discard block |
||
72 | 72 | |
73 | 73 | public function setMenu() |
74 | 74 | { |
75 | - if ($this->menu) return; |
|
75 | + if ($this->menu) { |
|
76 | + return; |
|
77 | + } |
|
76 | 78 | |
77 | 79 | //.ui.sidebar, |
78 | 80 | $this->menu = $this->add(['Menu', 'atk-topMenu fixed horizontal', 'element' => 'header'], 'TopMenu'); |
@@ -120,7 +122,9 @@ discard block |
||
120 | 122 | |
121 | 123 | public function setMenuRight() |
122 | 124 | { |
123 | - if ($this->menuRight) return; |
|
125 | + if ($this->menuRight) { |
|
126 | + return; |
|
127 | + } |
|
124 | 128 | |
125 | 129 | $this->menuRight = $this->menu->add(new RightMenu([ |
126 | 130 | 'ui' => false |
@@ -129,11 +133,15 @@ discard block |
||
129 | 133 | |
130 | 134 | public function setMenuLeft() |
131 | 135 | { |
132 | - if ($this->menuLeft) return; |
|
136 | + if ($this->menuLeft) { |
|
137 | + return; |
|
138 | + } |
|
133 | 139 | |
134 | 140 | $this->menuLeft = $this->add(new NavMenu('left vertical labeled sidebar'), 'LeftMenu'); |
135 | 141 | |
136 | - if (! $this->burger) return; |
|
142 | + if (! $this->burger) { |
|
143 | + return; |
|
144 | + } |
|
137 | 145 | |
138 | 146 | if (! session()->get('menu', 1)) { |
139 | 147 | $this->isMenuLeftVisible = false; |
@@ -152,7 +160,9 @@ discard block |
||
152 | 160 | |
153 | 161 | public function setActionBar() |
154 | 162 | { |
155 | - if ($this->actionBar) return; |
|
163 | + if ($this->actionBar) { |
|
164 | + return; |
|
165 | + } |
|
156 | 166 | |
157 | 167 | $this->actionBar = $this->add(new ActionBar(), 'ActionBar'); |
158 | 168 | } |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | $this->addHeader($this->app->title); |
20 | 20 | |
21 | 21 | $items = collect(); |
22 | - foreach(NavMenuJoint::collect() as $joint) { |
|
22 | + foreach (NavMenuJoint::collect() as $joint) { |
|
23 | 23 | $items = $items->merge($joint->items()); |
24 | 24 | } |
25 | 25 | |
@@ -36,13 +36,13 @@ discard block |
||
36 | 36 | |
37 | 37 | public static function addItems($menu, Collection $items) |
38 | 38 | { |
39 | - $items->sort(function ($entry1, $entry2) { |
|
39 | + $items->sort(function($entry1, $entry2) { |
|
40 | 40 | $weight1 = $entry1['weight']?? 10; |
41 | 41 | $weight2 = $entry2['weight']?? 10; |
42 | 42 | |
43 | 43 | return $weight1 <=> $weight2; |
44 | 44 | })->map(function($item, $caption) use ($menu) { |
45 | - if (! ($item['access']?? true)) return; |
|
45 | + if (!($item['access']?? true)) return; |
|
46 | 46 | |
47 | 47 | if (!isset($item['link']) && !is_array($item)) { |
48 | 48 | $item = [ |
@@ -42,7 +42,9 @@ discard block |
||
42 | 42 | |
43 | 43 | return $weight1 <=> $weight2; |
44 | 44 | })->map(function($item, $caption) use ($menu) { |
45 | - if (! ($item['access']?? true)) return; |
|
45 | + if (! ($item['access']?? true)) { |
|
46 | + return; |
|
47 | + } |
|
46 | 48 | |
47 | 49 | if (!isset($item['link']) && !is_array($item)) { |
48 | 50 | $item = [ |
@@ -60,8 +62,7 @@ discard block |
||
60 | 62 | $submenu = $menu->addMenu($item['caption']); |
61 | 63 | |
62 | 64 | self::addItems($submenu, collect($subitems)); |
63 | - } |
|
64 | - elseif ($subitems = $item['group']?? []) { |
|
65 | + } elseif ($subitems = $item['group']?? []) { |
|
65 | 66 | $subgroup = $menu->addGroup($item['caption']); |
66 | 67 | |
67 | 68 | if (($item['toggle']?? false) && !$menu->in_dropdown) { |
@@ -70,8 +71,7 @@ discard block |
||
70 | 71 | } |
71 | 72 | |
72 | 73 | self::addItems($subgroup, collect($subitems)); |
73 | - } |
|
74 | - elseif ($subitems = $item['accordion']?? []) { |
|
74 | + } elseif ($subitems = $item['accordion']?? []) { |
|
75 | 75 | $accordion = $menu->add(['Accordion']); |
76 | 76 | |
77 | 77 | $section = $accordion->addSection($item['caption']); |
@@ -94,12 +94,10 @@ discard block |
||
94 | 94 | } |
95 | 95 | } |
96 | 96 | // self::addItems($accordion, collect($subitems)); |
97 | - } |
|
98 | - else { |
|
97 | + } else { |
|
99 | 98 | if (is_a($menu, Accordion::class)) { |
100 | 99 | $menu->add(['View', 'Test']); |
101 | - } |
|
102 | - else { |
|
100 | + } else { |
|
103 | 101 | $menu->addItem($item['caption'], $item['link']?? ''); |
104 | 102 | } |
105 | 103 |
@@ -15,13 +15,13 @@ discard block |
||
15 | 15 | private static $cache; |
16 | 16 | |
17 | 17 | private static function cache() { |
18 | - if(isset(self::$cache) || ! Schema::hasTable('modules')) return []; |
|
18 | + if (isset(self::$cache) || !Schema::hasTable('modules')) return []; |
|
19 | 19 | |
20 | 20 | self::$cache = self::pluck('class', 'alias'); |
21 | 21 | } |
22 | 22 | |
23 | 23 | public static function isInstalled($classOrAlias) { |
24 | - return self::getClass($classOrAlias)? 1: 0; |
|
24 | + return self::getClass($classOrAlias) ? 1 : 0; |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | public static function getClass($classOrAlias) { |
@@ -48,9 +48,9 @@ discard block |
||
48 | 48 | { |
49 | 49 | $ret = []; |
50 | 50 | foreach (self::getInstalled() as $module) { |
51 | - if (! $list = $module::$method()) continue; |
|
51 | + if (!$list = $module::$method()) continue; |
|
52 | 52 | |
53 | - $ret = array_merge($ret, is_array($list)? $list: [$list]); |
|
53 | + $ret = array_merge($ret, is_array($list) ? $list : [$list]); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | return $ret; |
@@ -15,7 +15,9 @@ discard block |
||
15 | 15 | private static $cache; |
16 | 16 | |
17 | 17 | private static function cache() { |
18 | - if(isset(self::$cache) || ! Schema::hasTable('modules')) return []; |
|
18 | + if(isset(self::$cache) || ! Schema::hasTable('modules')) { |
|
19 | + return []; |
|
20 | + } |
|
19 | 21 | |
20 | 22 | self::$cache = self::pluck('class', 'alias'); |
21 | 23 | } |
@@ -27,7 +29,9 @@ discard block |
||
27 | 29 | public static function getClass($classOrAlias) { |
28 | 30 | self::cache(); |
29 | 31 | |
30 | - if (self::$cache->contains($classOrAlias)) return $classOrAlias; |
|
32 | + if (self::$cache->contains($classOrAlias)) { |
|
33 | + return $classOrAlias; |
|
34 | + } |
|
31 | 35 | |
32 | 36 | return self::$cache[$classOrAlias]?? null; |
33 | 37 | } |
@@ -48,7 +52,9 @@ discard block |
||
48 | 52 | { |
49 | 53 | $ret = []; |
50 | 54 | foreach (self::getInstalled() as $module) { |
51 | - if (! $list = $module::$method()) continue; |
|
55 | + if (! $list = $module::$method()) { |
|
56 | + continue; |
|
57 | + } |
|
52 | 58 | |
53 | 59 | $ret = array_merge($ret, is_array($list)? $list: [$list]); |
54 | 60 | } |