@@ -14,13 +14,13 @@ discard block |
||
14 | 14 | private static $cache; |
15 | 15 | |
16 | 16 | private static function cache() { |
17 | - if(isset(self::$cache)) return; |
|
17 | + if (isset(self::$cache)) return; |
|
18 | 18 | |
19 | 19 | self::$cache = self::pluck('class', 'alias'); |
20 | 20 | } |
21 | 21 | |
22 | 22 | public static function isInstalled($classOrAlias) { |
23 | - return self::getClass($classOrAlias)? 1: 0; |
|
23 | + return self::getClass($classOrAlias) ? 1 : 0; |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | public static function getClass($classOrAlias) { |
@@ -47,9 +47,9 @@ discard block |
||
47 | 47 | { |
48 | 48 | $ret = []; |
49 | 49 | foreach (self::getInstalled() as $module) { |
50 | - if (! $list = $module::$method()) continue; |
|
50 | + if (!$list = $module::$method()) continue; |
|
51 | 51 | |
52 | - $ret = array_merge($ret, is_array($list)? $list: [$list]); |
|
52 | + $ret = array_merge($ret, is_array($list) ? $list : [$list]); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | return $ret; |
@@ -14,7 +14,9 @@ discard block |
||
14 | 14 | private static $cache; |
15 | 15 | |
16 | 16 | private static function cache() { |
17 | - if(isset(self::$cache)) return; |
|
17 | + if(isset(self::$cache)) { |
|
18 | + return; |
|
19 | + } |
|
18 | 20 | |
19 | 21 | self::$cache = self::pluck('class', 'alias'); |
20 | 22 | } |
@@ -26,7 +28,9 @@ discard block |
||
26 | 28 | public static function getClass($classOrAlias) { |
27 | 29 | self::cache(); |
28 | 30 | |
29 | - if (self::$cache->contains($classOrAlias)) return $classOrAlias; |
|
31 | + if (self::$cache->contains($classOrAlias)) { |
|
32 | + return $classOrAlias; |
|
33 | + } |
|
30 | 34 | |
31 | 35 | return self::$cache[$classOrAlias]?? null; |
32 | 36 | } |
@@ -47,7 +51,9 @@ discard block |
||
47 | 51 | { |
48 | 52 | $ret = []; |
49 | 53 | foreach (self::getInstalled() as $module) { |
50 | - if (! $list = $module::$method()) continue; |
|
54 | + if (! $list = $module::$method()) { |
|
55 | + continue; |
|
56 | + } |
|
51 | 57 | |
52 | 58 | $ret = array_merge($ret, is_array($list)? $list: [$list]); |
53 | 59 | } |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | private static $variables; |
18 | 18 | |
19 | 19 | private static function cache() { |
20 | - if(isset(self::$variables)) return; |
|
20 | + if (isset(self::$variables)) return; |
|
21 | 21 | |
22 | 22 | self::$variables = self::pluck('value', 'name'); |
23 | 23 | } |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | public static function get($name, $throwError = true) { |
26 | 26 | self::cache(); |
27 | 27 | |
28 | - if (! self::$variables->has($name) && $throwError) { |
|
28 | + if (!self::$variables->has($name) && $throwError) { |
|
29 | 29 | throw new \Exception('No such variable in database: ' . $name); |
30 | 30 | } |
31 | 31 | |
@@ -46,10 +46,10 @@ discard block |
||
46 | 46 | return self::updateOrCreate(compact('name'), compact('value')); |
47 | 47 | } |
48 | 48 | |
49 | - public static function forget($name, $throwError=true) { |
|
49 | + public static function forget($name, $throwError = true) { |
|
50 | 50 | self::cache(); |
51 | 51 | |
52 | - if (! self::$variables->has($name) && $throwError) { |
|
52 | + if (!self::$variables->has($name) && $throwError) { |
|
53 | 53 | throw new \Exception('No such variable in database: ' . $name); |
54 | 54 | } |
55 | 55 |
@@ -17,7 +17,9 @@ |
||
17 | 17 | private static $variables; |
18 | 18 | |
19 | 19 | private static function cache() { |
20 | - if(isset(self::$variables)) return; |
|
20 | + if(isset(self::$variables)) { |
|
21 | + return; |
|
22 | + } |
|
21 | 23 | |
22 | 24 | self::$variables = self::pluck('value', 'name'); |
23 | 25 | } |
@@ -6,37 +6,37 @@ |
||
6 | 6 | |
7 | 7 | class CreateCoreTables extends Migration |
8 | 8 | { |
9 | - /** |
|
10 | - * Run the migrations. |
|
11 | - * |
|
12 | - * @return void |
|
13 | - */ |
|
14 | - public function up() |
|
15 | - { |
|
16 | - $this->down(); |
|
9 | + /** |
|
10 | + * Run the migrations. |
|
11 | + * |
|
12 | + * @return void |
|
13 | + */ |
|
14 | + public function up() |
|
15 | + { |
|
16 | + $this->down(); |
|
17 | 17 | |
18 | - Schema::create('variables', function (Blueprint $table) { |
|
19 | - $table->string('name', 128)->primary(); |
|
20 | - $table->text('value'); |
|
21 | - }); |
|
18 | + Schema::create('variables', function (Blueprint $table) { |
|
19 | + $table->string('name', 128)->primary(); |
|
20 | + $table->text('value'); |
|
21 | + }); |
|
22 | 22 | |
23 | - Schema::create('modules', function (Blueprint $table) { |
|
24 | - $table->string('class', 512)->unique(); |
|
25 | - $table->string('alias', 128)->unique(); |
|
26 | - $table->smallInteger('priority'); |
|
27 | - $table->smallInteger('state'); |
|
28 | - }); |
|
29 | - } |
|
23 | + Schema::create('modules', function (Blueprint $table) { |
|
24 | + $table->string('class', 512)->unique(); |
|
25 | + $table->string('alias', 128)->unique(); |
|
26 | + $table->smallInteger('priority'); |
|
27 | + $table->smallInteger('state'); |
|
28 | + }); |
|
29 | + } |
|
30 | 30 | |
31 | - /** |
|
32 | - * Reverse the migrations. |
|
33 | - * |
|
34 | - * @return void |
|
35 | - */ |
|
36 | - public function down() |
|
37 | - { |
|
38 | - Schema::dropIfExists('variables'); |
|
31 | + /** |
|
32 | + * Reverse the migrations. |
|
33 | + * |
|
34 | + * @return void |
|
35 | + */ |
|
36 | + public function down() |
|
37 | + { |
|
38 | + Schema::dropIfExists('variables'); |
|
39 | 39 | |
40 | - Schema::dropIfExists('modules'); |
|
41 | - } |
|
40 | + Schema::dropIfExists('modules'); |
|
41 | + } |
|
42 | 42 | } |
@@ -15,12 +15,12 @@ |
||
15 | 15 | { |
16 | 16 | $this->down(); |
17 | 17 | |
18 | - Schema::create('variables', function (Blueprint $table) { |
|
18 | + Schema::create('variables', function(Blueprint $table) { |
|
19 | 19 | $table->string('name', 128)->primary(); |
20 | 20 | $table->text('value'); |
21 | 21 | }); |
22 | 22 | |
23 | - Schema::create('modules', function (Blueprint $table) { |
|
23 | + Schema::create('modules', function(Blueprint $table) { |
|
24 | 24 | $table->string('class', 512)->unique(); |
25 | 25 | $table->string('alias', 128)->unique(); |
26 | 26 | $table->smallInteger('priority'); |
@@ -23,7 +23,9 @@ |
||
23 | 23 | } |
24 | 24 | } |
25 | 25 | |
26 | - if (empty ($view)) abort(404); |
|
26 | + if (empty ($view)) { |
|
27 | + abort(404); |
|
28 | + } |
|
27 | 29 | |
28 | 30 | $epesi->add($view)->displayModuleContent($method, $args); |
29 | 31 |
@@ -24,9 +24,9 @@ discard block |
||
24 | 24 | //TODO: set the skin from admin / user selection |
25 | 25 | $skin = config('epesi.app.skin', $this->skin); |
26 | 26 | |
27 | - $this->template_dir = $this->template_dir?: []; |
|
27 | + $this->template_dir = $this->template_dir ?: []; |
|
28 | 28 | |
29 | - $this->template_dir[] = __DIR__.'/UI/Templates/'. $skin; |
|
29 | + $this->template_dir[] = __DIR__ . '/UI/Templates/' . $skin; |
|
30 | 30 | |
31 | 31 | parent::__construct([ |
32 | 32 | 'title' => config('epesi.app.title', 'EPESI'), |
@@ -81,31 +81,31 @@ discard block |
||
81 | 81 | //TODO: include below in app.js and app.css |
82 | 82 | // jQuery |
83 | 83 | $urlJs = $this->cdn['jquery']?? 'modules/system/js'; |
84 | - $this->requireJS($urlJs.'/jquery.min.js'); |
|
84 | + $this->requireJS($urlJs . '/jquery.min.js'); |
|
85 | 85 | |
86 | 86 | // Semantic UI |
87 | 87 | $urlJs = $this->cdn['semantic-ui']?? 'modules/system/js'; |
88 | 88 | $urlCss = $this->cdn['semantic-ui']?? 'modules/system/css'; |
89 | - $this->requireJS($urlJs.'/semantic.min.js'); |
|
90 | - $this->requireCSS($urlCss.'/semantic.min.css'); |
|
89 | + $this->requireJS($urlJs . '/semantic.min.js'); |
|
90 | + $this->requireCSS($urlCss . '/semantic.min.css'); |
|
91 | 91 | |
92 | 92 | // Serialize Object |
93 | 93 | $urlJs = $this->cdn['serialize-object']?? 'modules/system/js'; |
94 | - $this->requireJS($urlJs.'/jquery.serialize-object.min.js'); |
|
94 | + $this->requireJS($urlJs . '/jquery.serialize-object.min.js'); |
|
95 | 95 | |
96 | 96 | // Agile UI |
97 | 97 | $urlJs = $this->cdn['atk']?? 'modules/system/js'; |
98 | 98 | $urlCss = $this->cdn['atk']?? 'modules/system/css'; |
99 | - $this->requireJS($urlJs.'/atkjs-ui.min.js'); |
|
100 | - $this->requireCSS($urlCss.'/agileui.css'); |
|
99 | + $this->requireJS($urlJs . '/atkjs-ui.min.js'); |
|
100 | + $this->requireCSS($urlCss . '/agileui.css'); |
|
101 | 101 | |
102 | 102 | // Draggable |
103 | 103 | $urlJs = $this->cdn['draggable']?? 'modules/system/js'; |
104 | - $this->requireJS($urlJs.'/draggable.bundle.js'); |
|
104 | + $this->requireJS($urlJs . '/draggable.bundle.js'); |
|
105 | 105 | |
106 | 106 | // jQuery UI |
107 | 107 | $urlJs = $this->cdn['jquery-ui']?? 'modules/system/js'; |
108 | - $this->requireJS($urlJs.'/jquery-ui.js'); |
|
108 | + $this->requireJS($urlJs . '/jquery-ui.js'); |
|
109 | 109 | |
110 | 110 | // $this->requireJS('https://cdnjs.cloudflare.com/ajax/libs/jquery.nicescroll/3.7.6/jquery.nicescroll.min.js'); |
111 | 111 | } |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | |
180 | 180 | $key = md5(serialize(func_get_args())); |
181 | 181 | |
182 | - if (! isset($cache[$key])) { |
|
182 | + if (!isset($cache[$key])) { |
|
183 | 183 | $cache[$key] = true; |
184 | 184 | |
185 | 185 | parent::requireJS($url, $isAsync, $isDefer); |
@@ -38,12 +38,12 @@ discard block |
||
38 | 38 | 'title' => __('Launchpad'), |
39 | 39 | ]); |
40 | 40 | |
41 | - foreach(UserMenuJoint::collect() as $joint) { |
|
42 | - foreach ($joint->tools()?: [] as $tool) { |
|
41 | + foreach (UserMenuJoint::collect() as $joint) { |
|
42 | + foreach ($joint->tools() ?: [] as $tool) { |
|
43 | 43 | $this->addTool($tool); |
44 | 44 | } |
45 | 45 | |
46 | - foreach ($joint->entries()?: [] as $entry) { |
|
46 | + foreach ($joint->entries() ?: [] as $entry) { |
|
47 | 47 | $this->addEntry($entry); |
48 | 48 | } |
49 | 49 | } |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | 'item' => ['Logout', 'icon' => 'sign out', 'attr' => ['onclick' => "event.preventDefault();$('#logout-form').submit();"]], |
62 | 62 | 'action' => url('logout'), |
63 | 63 | 'group' => '10000:user', |
64 | - 'callback' => function ($item){ |
|
64 | + 'callback' => function($item) { |
|
65 | 65 | $logoutForm = $item->add(['View', 'attr' => ['method' => 'POST', 'action' => URL::to('logout')]])->setElement('form')->addStyle(['display' => 'none']); |
66 | 66 | $logoutForm->id = 'logout-form'; |
67 | 67 | $logoutForm->add(['View', 'attr' => ['type' => 'hidden', 'name' => '_token', 'value' => csrf_token()]])->setElement('input'); |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | { |
74 | 74 | $entry = collect(array_merge(['item' => $entry, 'group' => '00500:general', 'weight' => 10], $entry)); |
75 | 75 | |
76 | - if (! $entry->get('item')) return; |
|
76 | + if (!$entry->get('item')) return; |
|
77 | 77 | |
78 | 78 | $this->entries->add($entry); |
79 | 79 | } |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | |
102 | 102 | $item = $this->userMenu->addItem($entry['item'], $entry->get('action')); |
103 | 103 | |
104 | - if (! $callback = $entry->get('callback')) continue; |
|
104 | + if (!$callback = $entry->get('callback')) continue; |
|
105 | 105 | |
106 | 106 | $callback($item); |
107 | 107 | } |
@@ -73,7 +73,9 @@ discard block |
||
73 | 73 | { |
74 | 74 | $entry = collect(array_merge(['item' => $entry, 'group' => '00500:general', 'weight' => 10], $entry)); |
75 | 75 | |
76 | - if (! $entry->get('item')) return; |
|
76 | + if (! $entry->get('item')) { |
|
77 | + return; |
|
78 | + } |
|
77 | 79 | |
78 | 80 | $this->entries->add($entry); |
79 | 81 | } |
@@ -94,14 +96,18 @@ discard block |
||
94 | 96 | { |
95 | 97 | $empty = true; |
96 | 98 | foreach ($this->entries->groupBy('group')->sortKeys() as $group) { |
97 | - if (!$empty) $this->userMenu->addDivider(); |
|
99 | + if (!$empty) { |
|
100 | + $this->userMenu->addDivider(); |
|
101 | + } |
|
98 | 102 | |
99 | 103 | foreach ($group->sortBy('weight') as $entry) { |
100 | 104 | $empty = false; |
101 | 105 | |
102 | 106 | $item = $this->userMenu->addItem($entry['item'], $entry->get('action')); |
103 | 107 | |
104 | - if (! $callback = $entry->get('callback')) continue; |
|
108 | + if (! $callback = $entry->get('callback')) { |
|
109 | + continue; |
|
110 | + } |
|
105 | 111 | |
106 | 112 | $callback($item); |
107 | 113 | } |
@@ -4,6 +4,6 @@ |
||
4 | 4 | |
5 | 5 | class LaunchButton extends ActionButton |
6 | 6 | { |
7 | - public $ui = 'basic launch pjax button'; |
|
7 | + public $ui = 'basic launch pjax button'; |
|
8 | 8 | |
9 | 9 | } |
@@ -30,36 +30,36 @@ discard block |
||
30 | 30 | */ |
31 | 31 | class AdminLayout extends Generic |
32 | 32 | { |
33 | - public $menuLeft; // vertical menu |
|
34 | - public $menu; // horizontal menu |
|
35 | - public $menuRight; // vertical pull-down |
|
36 | - public $actionBar; |
|
37 | - public $locationBar; |
|
33 | + public $menuLeft; // vertical menu |
|
34 | + public $menu; // horizontal menu |
|
35 | + public $menuRight; // vertical pull-down |
|
36 | + public $actionBar; |
|
37 | + public $locationBar; |
|
38 | 38 | |
39 | - public $burger = true; // burger menu item |
|
39 | + public $burger = true; // burger menu item |
|
40 | 40 | |
41 | - /* |
|
41 | + /* |
|
42 | 42 | * Whether or not left Menu is visible on Page load. |
43 | 43 | */ |
44 | - public $isMenuLeftVisible = true; |
|
44 | + public $isMenuLeftVisible = true; |
|
45 | 45 | |
46 | - public $defaultTemplate = 'layout/admin.html'; |
|
46 | + public $defaultTemplate = 'layout/admin.html'; |
|
47 | 47 | |
48 | - protected $location; |
|
48 | + protected $location; |
|
49 | 49 | |
50 | - public function init() |
|
51 | - { |
|
52 | - parent::init(); |
|
50 | + public function init() |
|
51 | + { |
|
52 | + parent::init(); |
|
53 | 53 | |
54 | - $this->setMenu(); |
|
55 | - $this->setActionBar(); |
|
54 | + $this->setMenu(); |
|
55 | + $this->setActionBar(); |
|
56 | 56 | |
57 | 57 | // if (request()->pjax()) return; |
58 | 58 | |
59 | - $this->setMenuLeft(); |
|
60 | - $this->setMenuRight(); |
|
59 | + $this->setMenuLeft(); |
|
60 | + $this->setMenuRight(); |
|
61 | 61 | |
62 | - $this->setVersion(); |
|
62 | + $this->setVersion(); |
|
63 | 63 | |
64 | 64 | // $this->js(true, null, 'body')->niceScroll(); |
65 | 65 | // $this->js(true, null, new jsExpression('window'))->on('pageshow', new jsFunction(['event'], [ |
@@ -67,23 +67,23 @@ discard block |
||
67 | 67 | // if (event.originalEvent.persisted) { |
68 | 68 | // window.location.reload(); |
69 | 69 | // }')])); |
70 | - } |
|
70 | + } |
|
71 | 71 | |
72 | - public function setMenu() |
|
73 | - { |
|
74 | - if ($this->menu) return; |
|
72 | + public function setMenu() |
|
73 | + { |
|
74 | + if ($this->menu) return; |
|
75 | 75 | |
76 | - //.ui.sidebar, |
|
77 | - $this->menu = $this->add(['Menu', 'atk-topMenu fixed horizontal', 'element' => 'header'], 'TopMenu'); |
|
76 | + //.ui.sidebar, |
|
77 | + $this->menu = $this->add(['Menu', 'atk-topMenu fixed horizontal', 'element' => 'header'], 'TopMenu'); |
|
78 | 78 | |
79 | - $this->app->addStyle(''); |
|
79 | + $this->app->addStyle(''); |
|
80 | 80 | |
81 | - // company logo |
|
82 | - $logo = $this->menu->add(['class' => ['epesi-logo']])->add(['Image', url('img/tsm_logo_agile.png')]); |
|
81 | + // company logo |
|
82 | + $logo = $this->menu->add(['class' => ['epesi-logo']])->add(['Image', url('img/tsm_logo_agile.png')]); |
|
83 | 83 | |
84 | - if ($this->burger) { |
|
85 | - $this->burger = $this->menu->addItem(['class' => ['icon atk-leftMenuTrigger']]); |
|
86 | - } |
|
84 | + if ($this->burger) { |
|
85 | + $this->burger = $this->menu->addItem(['class' => ['icon atk-leftMenuTrigger']]); |
|
86 | + } |
|
87 | 87 | |
88 | 88 | // home icon |
89 | 89 | $this->menu->addItem(['class' => ['icon epesi-home']], url('view/dashboard'))->add(['Icon', 'home']); |
@@ -125,52 +125,52 @@ discard block |
||
125 | 125 | ]), 'RightMenu')->addClass('right menu')->removeClass('item'); |
126 | 126 | } |
127 | 127 | |
128 | - public function setMenuLeft() |
|
129 | - { |
|
130 | - if ($this->menuLeft) return; |
|
128 | + public function setMenuLeft() |
|
129 | + { |
|
130 | + if ($this->menuLeft) return; |
|
131 | 131 | |
132 | - $this->menuLeft = $this->add(new NavMenu('left vertical labeled sidebar'), 'LeftMenu'); |
|
132 | + $this->menuLeft = $this->add(new NavMenu('left vertical labeled sidebar'), 'LeftMenu'); |
|
133 | 133 | |
134 | - $this->leftMenu = $this->menuLeft; |
|
134 | + $this->leftMenu = $this->menuLeft; |
|
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 | } |
@@ -30,13 +30,13 @@ discard block |
||
30 | 30 | */ |
31 | 31 | class AdminLayout extends Generic |
32 | 32 | { |
33 | - public $menuLeft; // vertical menu |
|
34 | - public $menu; // horizontal menu |
|
35 | - public $menuRight; // vertical pull-down |
|
33 | + public $menuLeft; // vertical menu |
|
34 | + public $menu; // horizontal menu |
|
35 | + public $menuRight; // vertical pull-down |
|
36 | 36 | public $actionBar; |
37 | 37 | public $locationBar; |
38 | 38 | |
39 | - public $burger = true; // burger menu item |
|
39 | + public $burger = true; // burger menu item |
|
40 | 40 | |
41 | 41 | /* |
42 | 42 | * Whether or not left Menu is visible on Page load. |
@@ -86,10 +86,10 @@ discard block |
||
86 | 86 | } |
87 | 87 | |
88 | 88 | // home icon |
89 | - $this->menu->addItem(['class' => ['icon epesi-home']], url('view/dashboard'))->add(['Icon', 'home']); |
|
89 | + $this->menu->addItem(['class' => ['icon epesi-home']], url('view/dashboard'))->add(['Icon', 'home']); |
|
90 | 90 | |
91 | 91 | // location bar |
92 | - $this->locationBar = $this->menu->add(['View', ['ui' => 'epesi-location']]); |
|
92 | + $this->locationBar = $this->menu->add(['View', ['ui' => 'epesi-location']]); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | public function setLocation($crumbs) |
@@ -133,20 +133,20 @@ discard block |
||
133 | 133 | |
134 | 134 | $this->leftMenu = $this->menuLeft; |
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 |
@@ -71,7 +71,9 @@ discard block |
||
71 | 71 | |
72 | 72 | public function setMenu() |
73 | 73 | { |
74 | - if ($this->menu) return; |
|
74 | + if ($this->menu) { |
|
75 | + return; |
|
76 | + } |
|
75 | 77 | |
76 | 78 | //.ui.sidebar, |
77 | 79 | $this->menu = $this->add(['Menu', 'atk-topMenu fixed horizontal', 'element' => 'header'], 'TopMenu'); |
@@ -118,7 +120,9 @@ discard block |
||
118 | 120 | |
119 | 121 | public function setMenuRight() |
120 | 122 | { |
121 | - if ($this->menuRight) return; |
|
123 | + if ($this->menuRight) { |
|
124 | + return; |
|
125 | + } |
|
122 | 126 | |
123 | 127 | $this->menuRight = $this->menu->add(new RightMenu([ |
124 | 128 | 'ui' => false |
@@ -127,13 +131,17 @@ discard block |
||
127 | 131 | |
128 | 132 | public function setMenuLeft() |
129 | 133 | { |
130 | - if ($this->menuLeft) return; |
|
134 | + if ($this->menuLeft) { |
|
135 | + return; |
|
136 | + } |
|
131 | 137 | |
132 | 138 | $this->menuLeft = $this->add(new NavMenu('left vertical labeled sidebar'), 'LeftMenu'); |
133 | 139 | |
134 | 140 | $this->leftMenu = $this->menuLeft; |
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 | } |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | protected $validationRules = []; |
18 | 18 | |
19 | 19 | public function addElements($elements, $parent = null) { |
20 | - $parent = $parent?: $this; |
|
20 | + $parent = $parent ?: $this; |
|
21 | 21 | |
22 | 22 | foreach ($elements as $name => $desc) { |
23 | 23 | $name = $desc['name']?? $name; |
@@ -26,9 +26,9 @@ discard block |
||
26 | 26 | |
27 | 27 | switch ($desc['type']?? 'field') { |
28 | 28 | case 'field': |
29 | - $desc = is_string($desc)? [ |
|
29 | + $desc = is_string($desc) ? [ |
|
30 | 30 | 'decorator' => [$desc] |
31 | - ]: $desc; |
|
31 | + ] : $desc; |
|
32 | 32 | |
33 | 33 | $field = $parent->addField($name, $desc['decorator']?? [], $desc['options']?? []); |
34 | 34 | |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | } |
78 | 78 | |
79 | 79 | public function addFieldsDisplayRules($fieldsDisplayRules) { |
80 | - $this->setFieldsDisplayRules(array_merge($this->fieldsDisplayRules?: [], $fieldsDisplayRules)); |
|
80 | + $this->setFieldsDisplayRules(array_merge($this->fieldsDisplayRules ?: [], $fieldsDisplayRules)); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | public function addGroupDisplayRules($groupDisplayRules) { |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | } |
90 | 90 | |
91 | 91 | public function addFieldRules($field, $rules = []) { |
92 | - if (! $rules) return; |
|
92 | + if (!$rules) return; |
|
93 | 93 | |
94 | 94 | $this->fieldRules[$field] = $rules['rules']?? [ |
95 | 95 | 'identifier' => $field, |
@@ -101,8 +101,8 @@ discard block |
||
101 | 101 | |
102 | 102 | public function setValues($values) |
103 | 103 | { |
104 | - foreach ($values?: [] as $name => $value) { |
|
105 | - if (! $field = $this->fields[$name]?? null) continue; |
|
104 | + foreach ($values ?: [] as $name => $value) { |
|
105 | + if (!$field = $this->fields[$name]?? null) continue; |
|
106 | 106 | |
107 | 107 | $field->set($value); |
108 | 108 | } |
@@ -125,17 +125,17 @@ discard block |
||
125 | 125 | 'fields' => $this->fieldRules |
126 | 126 | ]); |
127 | 127 | |
128 | - $this->onSubmit(function ($form) use ($callback) { |
|
128 | + $this->onSubmit(function($form) use ($callback) { |
|
129 | 129 | $errors = []; |
130 | - foreach ($this->validationRules?: [] as $ruleCallback) { |
|
131 | - if (! is_callable($ruleCallback)) continue; |
|
130 | + foreach ($this->validationRules ?: [] as $ruleCallback) { |
|
131 | + if (!is_callable($ruleCallback)) continue; |
|
132 | 132 | |
133 | 133 | $ruleErrors = $ruleCallback($form); |
134 | 134 | |
135 | - $errors = array_merge($errors, $ruleErrors?: []); |
|
135 | + $errors = array_merge($errors, $ruleErrors ?: []); |
|
136 | 136 | } |
137 | 137 | |
138 | - return $errors?: $callback($this); |
|
138 | + return $errors ?: $callback($this); |
|
139 | 139 | }); |
140 | 140 | |
141 | 141 | return $this; |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | |
149 | 149 | public function confirmLeave($confirm = true) |
150 | 150 | { |
151 | - $this->canLeave = ! $confirm; |
|
151 | + $this->canLeave = !$confirm; |
|
152 | 152 | |
153 | 153 | return $this; |
154 | 154 | } |
@@ -89,7 +89,9 @@ discard block |
||
89 | 89 | } |
90 | 90 | |
91 | 91 | public function addFieldRules($field, $rules = []) { |
92 | - if (! $rules) return; |
|
92 | + if (! $rules) { |
|
93 | + return; |
|
94 | + } |
|
93 | 95 | |
94 | 96 | $this->fieldRules[$field] = $rules['rules']?? [ |
95 | 97 | 'identifier' => $field, |
@@ -102,7 +104,9 @@ discard block |
||
102 | 104 | public function setValues($values) |
103 | 105 | { |
104 | 106 | foreach ($values?: [] as $name => $value) { |
105 | - if (! $field = $this->fields[$name]?? null) continue; |
|
107 | + if (! $field = $this->fields[$name]?? null) { |
|
108 | + continue; |
|
109 | + } |
|
106 | 110 | |
107 | 111 | $field->set($value); |
108 | 112 | } |
@@ -128,7 +132,9 @@ discard block |
||
128 | 132 | $this->onSubmit(function ($form) use ($callback) { |
129 | 133 | $errors = []; |
130 | 134 | foreach ($this->validationRules?: [] as $ruleCallback) { |
131 | - if (! is_callable($ruleCallback)) continue; |
|
135 | + if (! is_callable($ruleCallback)) { |
|
136 | + continue; |
|
137 | + } |
|
132 | 138 | |
133 | 139 | $ruleErrors = $ruleCallback($form); |
134 | 140 |