@@ -8,28 +8,28 @@ |
||
8 | 8 | |
9 | 9 | class ModuleManagerTest extends TestCase |
10 | 10 | { |
11 | - /** |
|
12 | - * Setup the test environment. |
|
13 | - */ |
|
14 | - protected function setUp(): void |
|
15 | - { |
|
16 | - parent::setUp(); |
|
11 | + /** |
|
12 | + * Setup the test environment. |
|
13 | + */ |
|
14 | + protected function setUp(): void |
|
15 | + { |
|
16 | + parent::setUp(); |
|
17 | 17 | |
18 | - config([ |
|
19 | - 'epesi.modules' => [ |
|
20 | - '\\Epesi\\Core\\' => __DIR__ . implode(DIRECTORY_SEPARATOR, ['..', '..', 'src']), |
|
21 | - ] |
|
22 | - ]); |
|
18 | + config([ |
|
19 | + 'epesi.modules' => [ |
|
20 | + '\\Epesi\\Core\\' => __DIR__ . implode(DIRECTORY_SEPARATOR, ['..', '..', 'src']), |
|
21 | + ] |
|
22 | + ]); |
|
23 | 23 | |
24 | - ModuleManager::install('system'); |
|
25 | - } |
|
24 | + ModuleManager::install('system'); |
|
25 | + } |
|
26 | 26 | |
27 | - public function testContentStorage() |
|
28 | - { |
|
29 | - $installedModules = ModuleManager::getInstalled(); |
|
27 | + public function testContentStorage() |
|
28 | + { |
|
29 | + $installedModules = ModuleManager::getInstalled(); |
|
30 | 30 | |
31 | - $this->assertArrayHasKey('system', $installedModules, 'System module not installed'); |
|
32 | - } |
|
31 | + $this->assertArrayHasKey('system', $installedModules, 'System module not installed'); |
|
32 | + } |
|
33 | 33 | |
34 | 34 | |
35 | 35 | } |
36 | 36 | \ No newline at end of file |
@@ -7,41 +7,41 @@ |
||
7 | 7 | |
8 | 8 | class VariablesTest extends TestCase |
9 | 9 | { |
10 | - /** |
|
11 | - * Setup the test environment. |
|
12 | - */ |
|
13 | - protected function setUp(): void |
|
14 | - { |
|
15 | - parent::setUp(); |
|
10 | + /** |
|
11 | + * Setup the test environment. |
|
12 | + */ |
|
13 | + protected function setUp(): void |
|
14 | + { |
|
15 | + parent::setUp(); |
|
16 | 16 | |
17 | - Variable::migrate(); |
|
18 | - } |
|
17 | + Variable::migrate(); |
|
18 | + } |
|
19 | 19 | |
20 | - public function testVariableStorage() |
|
21 | - { |
|
22 | - $varString = 'test'; |
|
20 | + public function testVariableStorage() |
|
21 | + { |
|
22 | + $varString = 'test'; |
|
23 | 23 | |
24 | - Variable::memorize('testString', $varString); |
|
24 | + Variable::memorize('testString', $varString); |
|
25 | 25 | |
26 | - $this->assertEquals($varString, Variable::recall('testString'), 'String variable not stored correctly in database'); |
|
26 | + $this->assertEquals($varString, Variable::recall('testString'), 'String variable not stored correctly in database'); |
|
27 | 27 | |
28 | - Variable::forget('testString'); |
|
28 | + Variable::forget('testString'); |
|
29 | 29 | |
30 | - $this->assertEmpty(Variable::recall('testString'), 'String variable not cleared correctly from database'); |
|
30 | + $this->assertEmpty(Variable::recall('testString'), 'String variable not cleared correctly from database'); |
|
31 | 31 | |
32 | - $varArray = [ |
|
33 | - 'aa' => 'test1', |
|
34 | - 'bb' => 'test2' |
|
35 | - ]; |
|
32 | + $varArray = [ |
|
33 | + 'aa' => 'test1', |
|
34 | + 'bb' => 'test2' |
|
35 | + ]; |
|
36 | 36 | |
37 | - Variable::memorize('testArray', $varArray); |
|
37 | + Variable::memorize('testArray', $varArray); |
|
38 | 38 | |
39 | - $this->assertEquals($varArray, Variable::recall('testArray'), 'Array variable not stored correctly in database'); |
|
39 | + $this->assertEquals($varArray, Variable::recall('testArray'), 'Array variable not stored correctly in database'); |
|
40 | 40 | |
41 | - Variable::forget('testArray'); |
|
41 | + Variable::forget('testArray'); |
|
42 | 42 | |
43 | - $this->assertEmpty(Variable::recall('testArray'), 'String variable not cleared correctly from database'); |
|
44 | - } |
|
43 | + $this->assertEmpty(Variable::recall('testArray'), 'String variable not cleared correctly from database'); |
|
44 | + } |
|
45 | 45 | |
46 | 46 | |
47 | 47 | } |
48 | 48 | \ No newline at end of file |
@@ -30,7 +30,7 @@ |
||
30 | 30 | |
31 | 31 | $grid->setModel(HomePage::create()); |
32 | 32 | |
33 | - $grid->addDragHandler()->onReorder(function ($order) { |
|
33 | + $grid->addDragHandler()->onReorder(function($order) { |
|
34 | 34 | foreach (HomePage::create() as $homepage) { |
35 | 35 | $homepage->save(['priority' => array_search($homepage['id'], $order)]); |
36 | 36 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | class HomePage extends Model |
12 | 12 | { |
13 | - use HasEpesiConnection; |
|
13 | + use HasEpesiConnection; |
|
14 | 14 | |
15 | 15 | public $table = 'home_pages'; |
16 | 16 | |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | parent::init(); |
30 | 30 | |
31 | 31 | $this->addFields([ |
32 | - 'path' => [ |
|
32 | + 'path' => [ |
|
33 | 33 | 'type' => 'enum', |
34 | 34 | 'caption' => __('Page'), |
35 | 35 | 'values' => self::list(), |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | 'filter' => true |
41 | 41 | ], |
42 | 42 | ], |
43 | - 'role' => [ |
|
43 | + 'role' => [ |
|
44 | 44 | 'type' => 'enum', |
45 | 45 | 'caption' => __('Role'), |
46 | 46 | 'values' => Role::get()->pluck('name', 'name')->all(), |
@@ -48,16 +48,16 @@ discard block |
||
48 | 48 | 'filter' => true |
49 | 49 | ] |
50 | 50 | ], |
51 | - 'date' => [ |
|
51 | + 'date' => [ |
|
52 | 52 | 'type' => 'date', |
53 | 53 | 'caption' => __('Date'), |
54 | - 'never_persist' => true, |
|
54 | + 'never_persist' => true, |
|
55 | 55 | 'ui' => [ |
56 | 56 | 'filter' => true |
57 | 57 | ] |
58 | 58 | ], |
59 | 59 | 'priority' => [ |
60 | - 'default' => 0 |
|
60 | + 'default' => 0 |
|
61 | 61 | ], |
62 | 62 | ]); |
63 | 63 |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | $this->setOrder('priority'); |
65 | 65 | |
66 | 66 | $this->addHook('beforeInsert', function($model, & $data) { |
67 | - $data['priority'] = $data['priority']?: $this->action('fx', ['max', 'priority'])->getOne() + 1; |
|
67 | + $data['priority'] = $data['priority'] ?: $this->action('fx', ['max', 'priority'])->getOne() + 1; |
|
68 | 68 | }); |
69 | 69 | } |
70 | 70 | |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | { |
78 | 78 | static $cache; |
79 | 79 | |
80 | - if (! isset($cache)) { |
|
80 | + if (!isset($cache)) { |
|
81 | 81 | $cache = []; |
82 | 82 | foreach (HomePageJoint::collect() as $joint) { |
83 | 83 | $cache[$joint->link()] = $joint->caption(); |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | */ |
95 | 95 | public static function ofUser() |
96 | 96 | { |
97 | - if (! $user = Auth::user()) return; |
|
97 | + if (!$user = Auth::user()) return; |
|
98 | 98 | |
99 | 99 | return self::create()->addCondition('role', $user->roles()->pluck('name')->toArray())->loadAny(); |
100 | 100 | } |
@@ -106,6 +106,6 @@ discard block |
||
106 | 106 | */ |
107 | 107 | public static function pathOfUser() |
108 | 108 | { |
109 | - return HomePage::ofUser()['path']?: self::$defaultPath; |
|
109 | + return HomePage::ofUser()['path'] ?: self::$defaultPath; |
|
110 | 110 | } |
111 | 111 | } |
@@ -94,7 +94,9 @@ |
||
94 | 94 | */ |
95 | 95 | public static function ofUser() |
96 | 96 | { |
97 | - if (! $user = Auth::user()) return; |
|
97 | + if (! $user = Auth::user()) { |
|
98 | + return; |
|
99 | + } |
|
98 | 100 | |
99 | 101 | return self::create()->addCondition('role', $user->roles()->pluck('name')->toArray())->loadAny(); |
100 | 102 | } |
@@ -21,14 +21,14 @@ |
||
21 | 21 | |
22 | 22 | public function install() |
23 | 23 | { |
24 | - Models\HomePage::migrate(); |
|
24 | + Models\HomePage::migrate(); |
|
25 | 25 | |
26 | 26 | // setup default home pages |
27 | 27 | Models\HomePage::create()->import([ |
28 | - [ |
|
29 | - 'path' => 'view/dashboard', |
|
30 | - 'role' => 'Super Admin' |
|
31 | - ], |
|
28 | + [ |
|
29 | + 'path' => 'view/dashboard', |
|
30 | + 'role' => 'Super Admin' |
|
31 | + ], |
|
32 | 32 | [ |
33 | 33 | 'path' => 'view/dashboard', |
34 | 34 | 'role' => 'Employee' |
@@ -41,33 +41,33 @@ |
||
41 | 41 | */ |
42 | 42 | public static function pluck($value, $key = null) |
43 | 43 | { |
44 | - return collect(self::create()->export())->pluck($value, $key); |
|
44 | + return collect(self::create()->export())->pluck($value, $key); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | // to be removed for atk4/data 2.0 |
48 | 48 | public function addFields($fields = [], $defaults = []) |
49 | 49 | { |
50 | - foreach ($fields as $key => $field) { |
|
51 | - if (!is_int($key)) { |
|
52 | - // field name can be passed as array key |
|
53 | - $name = $key; |
|
54 | - } elseif (is_string($field)) { |
|
55 | - // or it can be simple string = field name |
|
56 | - $name = $field; |
|
57 | - $field = []; |
|
58 | - } elseif (is_array($field) && isset($field[0]) && is_string($field[0])) { |
|
59 | - // or field name can be passed as first element of seed array (old behaviour) |
|
60 | - $name = array_shift($field); |
|
61 | - } else { |
|
62 | - // some unsupported format, maybe throw exception here? |
|
63 | - continue; |
|
64 | - } |
|
50 | + foreach ($fields as $key => $field) { |
|
51 | + if (!is_int($key)) { |
|
52 | + // field name can be passed as array key |
|
53 | + $name = $key; |
|
54 | + } elseif (is_string($field)) { |
|
55 | + // or it can be simple string = field name |
|
56 | + $name = $field; |
|
57 | + $field = []; |
|
58 | + } elseif (is_array($field) && isset($field[0]) && is_string($field[0])) { |
|
59 | + // or field name can be passed as first element of seed array (old behaviour) |
|
60 | + $name = array_shift($field); |
|
61 | + } else { |
|
62 | + // some unsupported format, maybe throw exception here? |
|
63 | + continue; |
|
64 | + } |
|
65 | 65 | |
66 | - $seed = array_merge($defaults, (array) $field); |
|
66 | + $seed = array_merge($defaults, (array) $field); |
|
67 | 67 | |
68 | - $this->addField($name, $seed); |
|
69 | - } |
|
68 | + $this->addField($name, $seed); |
|
69 | + } |
|
70 | 70 | |
71 | - return $this; |
|
71 | + return $this; |
|
72 | 72 | } |
73 | 73 | } |
74 | 74 | \ No newline at end of file |
@@ -30,36 +30,36 @@ discard block |
||
30 | 30 | */ |
31 | 31 | class LayoutView extends ModuleView |
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 | |
@@ -68,26 +68,26 @@ 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 | - $this->menu = $this->add(['Menu', 'atk-topMenu fixed horizontal', 'element' => 'header'], 'TopMenu'); |
|
77 | + $this->menu = $this->add(['Menu', 'atk-topMenu fixed horizontal', 'element' => 'header'], 'TopMenu'); |
|
78 | 78 | |
79 | - // company logo |
|
80 | - // see Epesi\Core\Controllers\SystemController::logo |
|
81 | - $this->menu->add(['class' => ['epesi-logo'], 'style' => ['width' => '167px']])->add(['Image', url('logo')])->setStyle(['max-height' => '32px']); |
|
79 | + // company logo |
|
80 | + // see Epesi\Core\Controllers\SystemController::logo |
|
81 | + $this->menu->add(['class' => ['epesi-logo'], 'style' => ['width' => '167px']])->add(['Image', url('logo')])->setStyle(['max-height' => '32px']); |
|
82 | 82 | |
83 | - if ($this->burger) { |
|
84 | - /** @scrutinizer ignore-call */ |
|
85 | - $this->burger = $this->menu->addItem(['class' => ['icon atk-leftMenuTrigger']]); |
|
86 | - } |
|
83 | + if ($this->burger) { |
|
84 | + /** @scrutinizer ignore-call */ |
|
85 | + $this->burger = $this->menu->addItem(['class' => ['icon atk-leftMenuTrigger']]); |
|
86 | + } |
|
87 | 87 | |
88 | 88 | // home icon redirects to /home path |
89 | 89 | // see Epesi\Core\Controllers\SystemController::home |
90 | - $this->menu->addItem(['class' => ['icon epesi-home']], url('home'))->add(['Icon', 'home']); |
|
90 | + $this->menu->addItem(['class' => ['icon epesi-home']], url('home'))->add(['Icon', 'home']); |
|
91 | 91 | |
92 | 92 | // location bar |
93 | 93 | $this->locationBar = $this->menu->add(['View', ['ui' => 'epesi-location']]); |
@@ -130,50 +130,50 @@ discard block |
||
130 | 130 | ]), 'RightMenu')->addClass('right menu')->removeClass('item'); |
131 | 131 | } |
132 | 132 | |
133 | - public function setMenuLeft() |
|
134 | - { |
|
135 | - if ($this->menuLeft) return; |
|
133 | + public function setMenuLeft() |
|
134 | + { |
|
135 | + if ($this->menuLeft) return; |
|
136 | 136 | |
137 | - $this->menuLeft = $this->add(new Seeds\NavMenu('left vertical labeled sidebar'), 'LeftMenu'); |
|
137 | + $this->menuLeft = $this->add(new Seeds\NavMenu('left vertical labeled sidebar'), 'LeftMenu'); |
|
138 | 138 | |
139 | - if (! $this->burger) return; |
|
139 | + if (! $this->burger) return; |
|
140 | 140 | |
141 | - if (! session()->get('menu', 1)) { |
|
142 | - $this->isMenuLeftVisible = false; |
|
143 | - } |
|
141 | + if (! session()->get('menu', 1)) { |
|
142 | + $this->isMenuLeftVisible = false; |
|
143 | + } |
|
144 | 144 | |
145 | - $this->burger->add(['Icon', 'content'])->on('click', [ |
|
146 | - (new jQuery('.ui.left.sidebar'))->toggleClass('visible'), |
|
147 | - (new jQuery('.epesi-logo'))->toggleClass('expanded'), |
|
148 | - (new jQuery('body'))->toggleClass('atk-leftMenu-visible'), |
|
149 | - $this->burger->add('jsCallback')->set(function($j, $visible) { |
|
150 | - session()->put('menu', $visible? 1: 0); |
|
151 | - session()->save(); |
|
152 | - }, [new \atk4\ui\jsExpression( '$("#' . $this->menuLeft->id . '").hasClass("visible")? 1: 0' )]) |
|
153 | - ]); |
|
154 | - } |
|
145 | + $this->burger->add(['Icon', 'content'])->on('click', [ |
|
146 | + (new jQuery('.ui.left.sidebar'))->toggleClass('visible'), |
|
147 | + (new jQuery('.epesi-logo'))->toggleClass('expanded'), |
|
148 | + (new jQuery('body'))->toggleClass('atk-leftMenu-visible'), |
|
149 | + $this->burger->add('jsCallback')->set(function($j, $visible) { |
|
150 | + session()->put('menu', $visible? 1: 0); |
|
151 | + session()->save(); |
|
152 | + }, [new \atk4\ui\jsExpression( '$("#' . $this->menuLeft->id . '").hasClass("visible")? 1: 0' )]) |
|
153 | + ]); |
|
154 | + } |
|
155 | 155 | |
156 | - public function setActionBar() |
|
157 | - { |
|
158 | - if ($this->actionBar) return; |
|
156 | + public function setActionBar() |
|
157 | + { |
|
158 | + if ($this->actionBar) return; |
|
159 | 159 | |
160 | - $this->actionBar = $this->add(new Seeds\ActionBar(), 'ActionBar'); |
|
161 | - } |
|
160 | + $this->actionBar = $this->add(new Seeds\ActionBar(), 'ActionBar'); |
|
161 | + } |
|
162 | 162 | |
163 | - public function setVersion() |
|
164 | - { |
|
165 | - $this->template->trySet('version', $this->app->version); |
|
166 | - } |
|
163 | + public function setVersion() |
|
164 | + { |
|
165 | + $this->template->trySet('version', $this->app->version); |
|
166 | + } |
|
167 | 167 | |
168 | - /** |
|
169 | - * {@inheritdoc} |
|
170 | - */ |
|
168 | + /** |
|
169 | + * {@inheritdoc} |
|
170 | + */ |
|
171 | 171 | |
172 | - public function renderView() |
|
173 | - { |
|
174 | - if ($this->menuLeft && $this->isMenuLeftVisible) { |
|
175 | - $this->menuLeft->addClass('visible'); |
|
176 | - } |
|
177 | - parent::renderView(); |
|
178 | - } |
|
172 | + public function renderView() |
|
173 | + { |
|
174 | + if ($this->menuLeft && $this->isMenuLeftVisible) { |
|
175 | + $this->menuLeft->addClass('visible'); |
|
176 | + } |
|
177 | + parent::renderView(); |
|
178 | + } |
|
179 | 179 | } |
@@ -11,66 +11,66 @@ |
||
11 | 11 | |
12 | 12 | class SystemController extends Controller |
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(Epesi $epesi) |
|
20 | - { |
|
21 | - // make sure the installation information is fresh |
|
22 | - ModuleManager::clearCache(); |
|
19 | + public function install(Epesi $epesi) |
|
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 | - $epesi->title = __(':epesi > Installation', ['epesi' => config('epesi.app.title')]); |
|
26 | + $epesi->title = __(':epesi > Installation', ['epesi' => config('epesi.app.title')]); |
|
27 | 27 | |
28 | - $epesi->initLayout('Centered'); |
|
28 | + $epesi->initLayout('Centered'); |
|
29 | 29 | |
30 | - $epesi->layout->set('logo', url('logo')); |
|
31 | - $epesi->layout->template->setHTML('copyright', config('epesi.app.copyright')); |
|
30 | + $epesi->layout->set('logo', url('logo')); |
|
31 | + $epesi->layout->template->setHTML('copyright', config('epesi.app.copyright')); |
|
32 | 32 | |
33 | - $epesi->add(new \Epesi\Core\System\SystemInstallWizard()); |
|
33 | + $epesi->add(new \Epesi\Core\System\SystemInstallWizard()); |
|
34 | 34 | |
35 | - return $epesi->response(); |
|
36 | - } |
|
35 | + return $epesi->response(); |
|
36 | + } |
|
37 | 37 | |
38 | - public function home() |
|
39 | - { |
|
40 | - return redirect(SystemCore::isInstalled()? \Epesi\Core\HomePage\Models\HomePage::pathOfUser(): 'install'); |
|
41 | - } |
|
38 | + public function home() |
|
39 | + { |
|
40 | + return redirect(SystemCore::isInstalled()? \Epesi\Core\HomePage\Models\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(Epesi $epesi, $module, $method = 'body', $args = []) |
|
51 | - { |
|
52 | - $epesi->initLayout(new LayoutView()); |
|
50 | + public function view(Epesi $epesi, $module, $method = 'body', $args = []) |
|
51 | + { |
|
52 | + $epesi->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 = new $viewClass(); |
|
65 | - } |
|
66 | - } |
|
63 | + if (class_exists($viewClass)) { |
|
64 | + $view = new $viewClass(); |
|
65 | + } |
|
66 | + } |
|
67 | 67 | |
68 | - if (! $view) abort(404); |
|
68 | + if (! $view) abort(404); |
|
69 | 69 | |
70 | - $epesi->add($view)->displayModuleContent($method, $args); |
|
70 | + $epesi->add($view)->displayModuleContent($method, $args); |
|
71 | 71 | |
72 | - $epesi->setLocation($view->location()); |
|
72 | + $epesi->setLocation($view->location()); |
|
73 | 73 | |
74 | - return $epesi->response(); |
|
75 | - } |
|
74 | + return $epesi->response(); |
|
75 | + } |
|
76 | 76 | } |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | { |
14 | 14 | public function index() |
15 | 15 | { |
16 | - return SystemCore::isInstalled()? redirect('home'): redirect('install'); |
|
16 | + return SystemCore::isInstalled() ? redirect('home') : redirect('install'); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | public function install(Epesi $epesi) |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | |
38 | 38 | public function home() |
39 | 39 | { |
40 | - return redirect(SystemCore::isInstalled()? \Epesi\Core\HomePage\Models\HomePage::pathOfUser(): 'install'); |
|
40 | + return redirect(SystemCore::isInstalled() ? \Epesi\Core\HomePage\Models\HomePage::pathOfUser() : 'install'); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | public function logo() |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | } |
66 | 66 | } |
67 | 67 | |
68 | - if (! $view) abort(404); |
|
68 | + if (!$view) abort(404); |
|
69 | 69 | |
70 | 70 | $epesi->add($view)->displayModuleContent($method, $args); |
71 | 71 |
@@ -83,43 +83,43 @@ |
||
83 | 83 | |
84 | 84 | public function renderException($exception) |
85 | 85 | { |
86 | - ob_start(); |
|
87 | - if ($exception instanceof TokenMismatchException) { |
|
88 | - $this->jsRedirectHomepage(__('Session expired! Redirecting to your home page ...')); |
|
89 | - } |
|
90 | - elseif ($exception instanceof NotFoundHttpException) { |
|
91 | - $this->jsRedirectHomepage(__('Requested page not found! Redirecting to your home page ...')); |
|
92 | - } |
|
93 | - else { |
|
94 | - $this->caughtException($exception); |
|
95 | - } |
|
86 | + ob_start(); |
|
87 | + if ($exception instanceof TokenMismatchException) { |
|
88 | + $this->jsRedirectHomepage(__('Session expired! Redirecting to your home page ...')); |
|
89 | + } |
|
90 | + elseif ($exception instanceof NotFoundHttpException) { |
|
91 | + $this->jsRedirectHomepage(__('Requested page not found! Redirecting to your home page ...')); |
|
92 | + } |
|
93 | + else { |
|
94 | + $this->caughtException($exception); |
|
95 | + } |
|
96 | 96 | |
97 | - return ob_get_clean(); |
|
97 | + return ob_get_clean(); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | public function jsRedirectHomepage($message) |
101 | 101 | { |
102 | - $homepageUrl = url(\Epesi\Core\HomePage\Database\Models\HomePage::pathOfUser()); |
|
102 | + $homepageUrl = url(\Epesi\Core\HomePage\Database\Models\HomePage::pathOfUser()); |
|
103 | 103 | |
104 | - $redirectJs = $this->jsRedirectConfirm($homepageUrl, $message)->jsRender(); |
|
104 | + $redirectJs = $this->jsRedirectConfirm($homepageUrl, $message)->jsRender(); |
|
105 | 105 | |
106 | - if ($this->isJsonRequest()) { |
|
107 | - $this->outputResponseJSON([ |
|
108 | - 'success' => true, |
|
109 | - 'message' => $message, |
|
110 | - 'atkjs' => $redirectJs |
|
111 | - ]); |
|
112 | - } |
|
113 | - else { |
|
114 | - $this->outputResponseHTML('<script>' . $redirectJs . '</script>'); |
|
115 | - } |
|
106 | + if ($this->isJsonRequest()) { |
|
107 | + $this->outputResponseJSON([ |
|
108 | + 'success' => true, |
|
109 | + 'message' => $message, |
|
110 | + 'atkjs' => $redirectJs |
|
111 | + ]); |
|
112 | + } |
|
113 | + else { |
|
114 | + $this->outputResponseHTML('<script>' . $redirectJs . '</script>'); |
|
115 | + } |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | public function jsRedirectConfirm($page, $message) |
119 | 119 | { |
120 | - $redirectJs = $this->jsRedirect($page)->jsRender(); |
|
120 | + $redirectJs = $this->jsRedirect($page)->jsRender(); |
|
121 | 121 | |
122 | - return new jsExpression("if (confirm([])) { $redirectJs }", [$message]); |
|
122 | + return new jsExpression("if (confirm([])) { $redirectJs }", [$message]); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | /** |
@@ -86,11 +86,9 @@ discard block |
||
86 | 86 | ob_start(); |
87 | 87 | if ($exception instanceof TokenMismatchException) { |
88 | 88 | $this->jsRedirectHomepage(__('Session expired! Redirecting to your home page ...')); |
89 | - } |
|
90 | - elseif ($exception instanceof NotFoundHttpException) { |
|
89 | + } elseif ($exception instanceof NotFoundHttpException) { |
|
91 | 90 | $this->jsRedirectHomepage(__('Requested page not found! Redirecting to your home page ...')); |
92 | - } |
|
93 | - else { |
|
91 | + } else { |
|
94 | 92 | $this->caughtException($exception); |
95 | 93 | } |
96 | 94 | |
@@ -109,8 +107,7 @@ discard block |
||
109 | 107 | 'message' => $message, |
110 | 108 | 'atkjs' => $redirectJs |
111 | 109 | ]); |
112 | - } |
|
113 | - else { |
|
110 | + } else { |
|
114 | 111 | $this->outputResponseHTML('<script>' . $redirectJs . '</script>'); |
115 | 112 | } |
116 | 113 | } |