@@ -41,6 +41,6 @@ |
||
| 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 | \ No newline at end of file |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | |
| 15 | 15 | public function __construct($parent) |
| 16 | 16 | { |
| 17 | - $this->parent = $parent; |
|
| 17 | + $this->parent = $parent; |
|
| 18 | 18 | |
| 19 | 19 | parent::__construct('$(this).atkCreateModal([arg])', [ |
| 20 | 20 | 'arg' => [ |
@@ -26,29 +26,29 @@ discard block |
||
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | protected function getURL() |
| 29 | - { |
|
| 30 | - return \atk4\ui\VirtualPage::addTo($this->parent)->set(Closure::fromCallable([$this, 'getContents']))->getJSURL('cut'); |
|
| 31 | - } |
|
| 29 | + { |
|
| 30 | + return \atk4\ui\VirtualPage::addTo($this->parent)->set(Closure::fromCallable([$this, 'getContents']))->getJSURL('cut'); |
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | - protected function getContents(VirtualPage $vp) |
|
| 34 | - { |
|
| 35 | - $vp->add([ |
|
| 36 | - new LaunchButton([ |
|
| 37 | - 'label' => 'Test Button 1', |
|
| 38 | - 'icon' => 'user' |
|
| 39 | - ]) |
|
| 40 | - ])->link(URL::to('/')); |
|
| 41 | - $vp->add([ |
|
| 42 | - new LaunchButton([ |
|
| 43 | - 'label' => 'Test Button 2', |
|
| 44 | - 'icon' => 'car' |
|
| 45 | - ]) |
|
| 46 | - ]); |
|
| 47 | - $vp->add([ |
|
| 48 | - new LaunchButton([ |
|
| 49 | - 'label' => 'Test Button 3', |
|
| 50 | - 'icon' => 'bus' |
|
| 51 | - ]) |
|
| 52 | - ]); |
|
| 53 | - } |
|
| 33 | + protected function getContents(VirtualPage $vp) |
|
| 34 | + { |
|
| 35 | + $vp->add([ |
|
| 36 | + new LaunchButton([ |
|
| 37 | + 'label' => 'Test Button 1', |
|
| 38 | + 'icon' => 'user' |
|
| 39 | + ]) |
|
| 40 | + ])->link(URL::to('/')); |
|
| 41 | + $vp->add([ |
|
| 42 | + new LaunchButton([ |
|
| 43 | + 'label' => 'Test Button 2', |
|
| 44 | + 'icon' => 'car' |
|
| 45 | + ]) |
|
| 46 | + ]); |
|
| 47 | + $vp->add([ |
|
| 48 | + new LaunchButton([ |
|
| 49 | + 'label' => 'Test Button 3', |
|
| 50 | + 'icon' => 'bus' |
|
| 51 | + ]) |
|
| 52 | + ]); |
|
| 53 | + } |
|
| 54 | 54 | } |
@@ -7,40 +7,40 @@ |
||
| 7 | 7 | |
| 8 | 8 | class ActionBarItem extends Item |
| 9 | 9 | { |
| 10 | - public $weight = 10; |
|
| 10 | + public $weight = 10; |
|
| 11 | 11 | |
| 12 | - public $callback; |
|
| 12 | + public $callback; |
|
| 13 | 13 | |
| 14 | - public $hint; |
|
| 14 | + public $hint; |
|
| 15 | 15 | |
| 16 | - public function renderView(): void |
|
| 17 | - { |
|
| 18 | - $this->addCallback(); |
|
| 16 | + public function renderView(): void |
|
| 17 | + { |
|
| 18 | + $this->addCallback(); |
|
| 19 | 19 | |
| 20 | - if ($this->hint) { |
|
| 21 | - $this->attr['title'] = $this->hint; |
|
| 22 | - } |
|
| 20 | + if ($this->hint) { |
|
| 21 | + $this->attr['title'] = $this->hint; |
|
| 22 | + } |
|
| 23 | 23 | |
| 24 | - parent::renderView(); |
|
| 25 | - } |
|
| 24 | + parent::renderView(); |
|
| 25 | + } |
|
| 26 | 26 | |
| 27 | - public function callback($callable) |
|
| 28 | - { |
|
| 29 | - $this->callback = $callable; |
|
| 27 | + public function callback($callable) |
|
| 28 | + { |
|
| 29 | + $this->callback = $callable; |
|
| 30 | 30 | |
| 31 | - return $this; |
|
| 32 | - } |
|
| 31 | + return $this; |
|
| 32 | + } |
|
| 33 | 33 | |
| 34 | - public function addCallback() |
|
| 35 | - { |
|
| 36 | - if (is_callable($callable = $this->callback)) { |
|
| 37 | - $callable = JsCallback::addTo($this)->set($callable); |
|
| 38 | - } |
|
| 34 | + public function addCallback() |
|
| 35 | + { |
|
| 36 | + if (is_callable($callable = $this->callback)) { |
|
| 37 | + $callable = JsCallback::addTo($this)->set($callable); |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | - if ($callable instanceof JsCallback) { |
|
| 41 | - $this->on('click', $callable); |
|
| 42 | - } |
|
| 40 | + if ($callable instanceof JsCallback) { |
|
| 41 | + $this->on('click', $callable); |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | - return $this; |
|
| 45 | - } |
|
| 44 | + return $this; |
|
| 45 | + } |
|
| 46 | 46 | } |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | |
| 9 | 9 | class ActionBar extends Menu |
| 10 | 10 | { |
| 11 | - public $ui = 'actionbar menu'; |
|
| 11 | + public $ui = 'actionbar menu'; |
|
| 12 | 12 | |
| 13 | 13 | protected static $buttons = []; |
| 14 | 14 | |
@@ -47,12 +47,12 @@ discard block |
||
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | public function renderView(): void |
| 50 | - { |
|
| 51 | - $this->elements = collect($this->elements)->sortByDesc(function ($element) { |
|
| 52 | - return $element->weight ?? 10; |
|
| 53 | - })->toArray(); |
|
| 50 | + { |
|
| 51 | + $this->elements = collect($this->elements)->sortByDesc(function ($element) { |
|
| 52 | + return $element->weight ?? 10; |
|
| 53 | + })->toArray(); |
|
| 54 | 54 | |
| 55 | - parent::renderView(); |
|
| 55 | + parent::renderView(); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | /** |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | |
| 83 | 83 | public static function addMenuButton($menu) |
| 84 | 84 | { |
| 85 | - return self::instance()->addMenu($menu); |
|
| 85 | + return self::instance()->addMenu($menu); |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | public static function clear() |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | 'icon' => 'arrow left', |
| 23 | 23 | 'weight' => 10000, |
| 24 | 24 | 'attr' => [ |
| 25 | - 'href' => $_SERVER['HTTP_REFERER']?? 'javascript:window.history.back()' |
|
| 25 | + 'href' => $_SERVER['HTTP_REFERER'] ?? 'javascript:window.history.back()' |
|
| 26 | 26 | ], |
| 27 | 27 | ], |
| 28 | 28 | 'save' => [ |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | |
| 49 | 49 | public function renderView(): void |
| 50 | 50 | { |
| 51 | - $this->elements = collect($this->elements)->sortByDesc(function ($element) { |
|
| 51 | + $this->elements = collect($this->elements)->sortByDesc(function($element) { |
|
| 52 | 52 | return $element->weight ?? 10; |
| 53 | 53 | })->toArray(); |
| 54 | 54 | |
@@ -64,9 +64,9 @@ discard block |
||
| 64 | 64 | */ |
| 65 | 65 | public static function addItemButton($button, $defaults = []) |
| 66 | 66 | { |
| 67 | - $button = is_string($button)? self::getPredefined($button): $button; |
|
| 67 | + $button = is_string($button) ? self::getPredefined($button) : $button; |
|
| 68 | 68 | |
| 69 | - $button = is_array($button)? new ActionBarItem($button): $button; |
|
| 69 | + $button = is_array($button) ? new ActionBarItem($button) : $button; |
|
| 70 | 70 | |
| 71 | 71 | $actionBar = self::instance(); |
| 72 | 72 | |
@@ -32,53 +32,53 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | class LayoutView extends \atk4\ui\Layout//ModuleView |
| 34 | 34 | { |
| 35 | - use SessionTrait; |
|
| 35 | + use SessionTrait; |
|
| 36 | 36 | |
| 37 | - /** |
|
| 38 | - * @var View\NavMenu |
|
| 39 | - */ |
|
| 40 | - public $menuLeft; // vertical menu |
|
| 37 | + /** |
|
| 38 | + * @var View\NavMenu |
|
| 39 | + */ |
|
| 40 | + public $menuLeft; // vertical menu |
|
| 41 | 41 | |
| 42 | - /** |
|
| 43 | - * @var \atk4\ui\Menu |
|
| 44 | - */ |
|
| 45 | - public $menu; // horizontal menu |
|
| 42 | + /** |
|
| 43 | + * @var \atk4\ui\Menu |
|
| 44 | + */ |
|
| 45 | + public $menu; // horizontal menu |
|
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * @var \atk4\ui\Menu |
|
| 49 | - */ |
|
| 50 | - public $menuRight; // vertical pull-down |
|
| 47 | + /** |
|
| 48 | + * @var \atk4\ui\Menu |
|
| 49 | + */ |
|
| 50 | + public $menuRight; // vertical pull-down |
|
| 51 | 51 | |
| 52 | - /** |
|
| 53 | - * @var View\ActionBar |
|
| 54 | - */ |
|
| 55 | - public $actionBar; |
|
| 56 | - public $locationBar; |
|
| 52 | + /** |
|
| 53 | + * @var View\ActionBar |
|
| 54 | + */ |
|
| 55 | + public $actionBar; |
|
| 56 | + public $locationBar; |
|
| 57 | 57 | |
| 58 | - public $burger = true; // burger menu item |
|
| 58 | + public $burger = true; // burger menu item |
|
| 59 | 59 | |
| 60 | - /* |
|
| 60 | + /* |
|
| 61 | 61 | * Whether or not left Menu is visible on Page load. |
| 62 | 62 | */ |
| 63 | - public $isMenuLeftVisible = true; |
|
| 63 | + public $isMenuLeftVisible = true; |
|
| 64 | 64 | |
| 65 | - public $defaultTemplate = 'layout/admin.html'; |
|
| 65 | + public $defaultTemplate = 'layout/admin.html'; |
|
| 66 | 66 | |
| 67 | - protected $location; |
|
| 67 | + protected $location; |
|
| 68 | 68 | |
| 69 | - protected function init(): void |
|
| 70 | - { |
|
| 71 | - parent::init(); |
|
| 69 | + protected function init(): void |
|
| 70 | + { |
|
| 71 | + parent::init(); |
|
| 72 | 72 | |
| 73 | - $this->setMenu(); |
|
| 74 | - $this->setActionBar(); |
|
| 73 | + $this->setMenu(); |
|
| 74 | + $this->setActionBar(); |
|
| 75 | 75 | |
| 76 | 76 | // if (request()->pjax()) return; |
| 77 | 77 | |
| 78 | - $this->setMenuLeft(); |
|
| 79 | - $this->setMenuRight(); |
|
| 78 | + $this->setMenuLeft(); |
|
| 79 | + $this->setMenuRight(); |
|
| 80 | 80 | |
| 81 | - $this->setVersion(); |
|
| 81 | + $this->setVersion(); |
|
| 82 | 82 | |
| 83 | 83 | // $this->js(true, null, 'body')->niceScroll(); |
| 84 | 84 | |
@@ -87,28 +87,28 @@ discard block |
||
| 87 | 87 | // if (event.originalEvent.persisted) { |
| 88 | 88 | // window.location.reload(); |
| 89 | 89 | // }')])); |
| 90 | - } |
|
| 90 | + } |
|
| 91 | 91 | |
| 92 | - public function setMenu() |
|
| 93 | - { |
|
| 94 | - if ($this->menu) return; |
|
| 92 | + public function setMenu() |
|
| 93 | + { |
|
| 94 | + if ($this->menu) return; |
|
| 95 | 95 | |
| 96 | - $this->menu = Menu::addTo($this, ['atk-topMenu fixed horizontal', 'element' => 'header'], ['TopMenu']); |
|
| 96 | + $this->menu = Menu::addTo($this, ['atk-topMenu fixed horizontal', 'element' => 'header'], ['TopMenu']); |
|
| 97 | 97 | |
| 98 | - // company logo |
|
| 99 | - // see \Epesi\Core\Controller::logo |
|
| 100 | - \atk4\ui\View::addTo($this->menu, ['class' => ['epesi-logo'], 'style' => ['width' => '167px']])->add([\atk4\ui\Image::class, url('logo')])->setStyle(['max-height' => '32px']); |
|
| 98 | + // company logo |
|
| 99 | + // see \Epesi\Core\Controller::logo |
|
| 100 | + \atk4\ui\View::addTo($this->menu, ['class' => ['epesi-logo'], 'style' => ['width' => '167px']])->add([\atk4\ui\Image::class, url('logo')])->setStyle(['max-height' => '32px']); |
|
| 101 | 101 | |
| 102 | - if ($this->burger) { |
|
| 103 | - $this->burger = $this->menu->addItem(['class' => ['icon atk-leftMenuTrigger']]); |
|
| 104 | - } |
|
| 102 | + if ($this->burger) { |
|
| 103 | + $this->burger = $this->menu->addItem(['class' => ['icon atk-leftMenuTrigger']]); |
|
| 104 | + } |
|
| 105 | 105 | |
| 106 | 106 | // home icon redirects to /home path |
| 107 | 107 | // see \Epesi\Core\Controller::home |
| 108 | - $this->menu->addItem(['class' => ['icon epesi-home']], url('home'))->add([\atk4\ui\Icon::class, 'home']); |
|
| 108 | + $this->menu->addItem(['class' => ['icon epesi-home']], url('home'))->add([\atk4\ui\Icon::class, 'home']); |
|
| 109 | 109 | |
| 110 | 110 | // location bar |
| 111 | - $this->locationBar = $this->menu->add([\atk4\ui\View::class, ['ui' => 'epesi-location']]); |
|
| 111 | + $this->locationBar = $this->menu->add([\atk4\ui\View::class, ['ui' => 'epesi-location']]); |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | /** |
@@ -151,49 +151,49 @@ discard block |
||
| 151 | 151 | ]), 'RightMenu')->addClass('right menu')->removeClass('item'); |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | - public function setMenuLeft() |
|
| 155 | - { |
|
| 156 | - if ($this->menuLeft) return; |
|
| 154 | + public function setMenuLeft() |
|
| 155 | + { |
|
| 156 | + if ($this->menuLeft) return; |
|
| 157 | 157 | |
| 158 | - $this->menuLeft = View\NavMenu::addTo($this, 'left vertical labeled sidebar', ['LeftMenu']); |
|
| 158 | + $this->menuLeft = View\NavMenu::addTo($this, 'left vertical labeled sidebar', ['LeftMenu']); |
|
| 159 | 159 | |
| 160 | - if (! $this->burger) return; |
|
| 160 | + if (! $this->burger) return; |
|
| 161 | 161 | |
| 162 | - $this->isMenuLeftVisible = $this->learn('menu', $this->isMenuLeftVisible); |
|
| 162 | + $this->isMenuLeftVisible = $this->learn('menu', $this->isMenuLeftVisible); |
|
| 163 | 163 | |
| 164 | - $this->burger->add([\atk4\ui\Icon::class, 'content'])->on('click', [ |
|
| 165 | - (new jQuery('.ui.left.sidebar'))->toggleClass('visible'), |
|
| 166 | - (new jQuery('.epesi-logo'))->toggleClass('expanded'), |
|
| 167 | - (new jQuery('body'))->toggleClass('atk-leftMenu-visible'), |
|
| 168 | - \atk4\ui\JsCallback::addTo($this->burger)->set(function($jsCallback, $visible) { |
|
| 169 | - $this->memorize('menu', filter_var($visible, FILTER_VALIDATE_BOOLEAN)); |
|
| 170 | - }, [$this->menuLeft->js(true)->hasClass('visible')]) |
|
| 171 | - ]); |
|
| 172 | - } |
|
| 164 | + $this->burger->add([\atk4\ui\Icon::class, 'content'])->on('click', [ |
|
| 165 | + (new jQuery('.ui.left.sidebar'))->toggleClass('visible'), |
|
| 166 | + (new jQuery('.epesi-logo'))->toggleClass('expanded'), |
|
| 167 | + (new jQuery('body'))->toggleClass('atk-leftMenu-visible'), |
|
| 168 | + \atk4\ui\JsCallback::addTo($this->burger)->set(function($jsCallback, $visible) { |
|
| 169 | + $this->memorize('menu', filter_var($visible, FILTER_VALIDATE_BOOLEAN)); |
|
| 170 | + }, [$this->menuLeft->js(true)->hasClass('visible')]) |
|
| 171 | + ]); |
|
| 172 | + } |
|
| 173 | 173 | |
| 174 | - public function setActionBar() |
|
| 175 | - { |
|
| 176 | - if ($this->actionBar) return; |
|
| 174 | + public function setActionBar() |
|
| 175 | + { |
|
| 176 | + if ($this->actionBar) return; |
|
| 177 | 177 | |
| 178 | - $this->actionBar = View\ActionBar::addTo($this, [], ['ActionBar']); |
|
| 178 | + $this->actionBar = View\ActionBar::addTo($this, [], ['ActionBar']); |
|
| 179 | 179 | |
| 180 | - return $this; |
|
| 181 | - } |
|
| 180 | + return $this; |
|
| 181 | + } |
|
| 182 | 182 | |
| 183 | - public function setVersion() |
|
| 184 | - { |
|
| 185 | - $this->template->trySet('version', $this->app->version); |
|
| 186 | - } |
|
| 183 | + public function setVersion() |
|
| 184 | + { |
|
| 185 | + $this->template->trySet('version', $this->app->version); |
|
| 186 | + } |
|
| 187 | 187 | |
| 188 | - /** |
|
| 189 | - * {@inheritdoc} |
|
| 190 | - */ |
|
| 188 | + /** |
|
| 189 | + * {@inheritdoc} |
|
| 190 | + */ |
|
| 191 | 191 | |
| 192 | - public function renderView(): void |
|
| 193 | - { |
|
| 194 | - if ($this->menuLeft && $this->isMenuLeftVisible) { |
|
| 195 | - $this->menuLeft->addClass('visible'); |
|
| 196 | - } |
|
| 197 | - parent::renderView(); |
|
| 198 | - } |
|
| 192 | + public function renderView(): void |
|
| 193 | + { |
|
| 194 | + if ($this->menuLeft && $this->isMenuLeftVisible) { |
|
| 195 | + $this->menuLeft->addClass('visible'); |
|
| 196 | + } |
|
| 197 | + parent::renderView(); |
|
| 198 | + } |
|
| 199 | 199 | } |
@@ -37,17 +37,17 @@ discard block |
||
| 37 | 37 | /** |
| 38 | 38 | * @var View\NavMenu |
| 39 | 39 | */ |
| 40 | - public $menuLeft; // vertical menu |
|
| 40 | + public $menuLeft; // vertical menu |
|
| 41 | 41 | |
| 42 | 42 | /** |
| 43 | 43 | * @var \atk4\ui\Menu |
| 44 | 44 | */ |
| 45 | - public $menu; // horizontal menu |
|
| 45 | + public $menu; // horizontal menu |
|
| 46 | 46 | |
| 47 | 47 | /** |
| 48 | 48 | * @var \atk4\ui\Menu |
| 49 | 49 | */ |
| 50 | - public $menuRight; // vertical pull-down |
|
| 50 | + public $menuRight; // vertical pull-down |
|
| 51 | 51 | |
| 52 | 52 | /** |
| 53 | 53 | * @var View\ActionBar |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | public $actionBar; |
| 56 | 56 | public $locationBar; |
| 57 | 57 | |
| 58 | - public $burger = true; // burger menu item |
|
| 58 | + public $burger = true; // burger menu item |
|
| 59 | 59 | |
| 60 | 60 | /* |
| 61 | 61 | * Whether or not left Menu is visible on Page load. |
@@ -122,8 +122,8 @@ discard block |
||
| 122 | 122 | |
| 123 | 123 | $title = []; |
| 124 | 124 | foreach ($crumbs as $level) { |
| 125 | - $label = $level['label']?? $level; |
|
| 126 | - $link = $level['link']?? null; |
|
| 125 | + $label = $level['label'] ?? $level; |
|
| 126 | + $link = $level['link'] ?? null; |
|
| 127 | 127 | |
| 128 | 128 | $crumb->addCrumb($label, $link); |
| 129 | 129 | |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | |
| 158 | 158 | $this->menuLeft = View\NavMenu::addTo($this, 'left vertical labeled sidebar', ['LeftMenu']); |
| 159 | 159 | |
| 160 | - if (! $this->burger) return; |
|
| 160 | + if (!$this->burger) return; |
|
| 161 | 161 | |
| 162 | 162 | $this->isMenuLeftVisible = $this->learn('menu', $this->isMenuLeftVisible); |
| 163 | 163 | |
@@ -91,7 +91,9 @@ discard block |
||
| 91 | 91 | |
| 92 | 92 | public function setMenu() |
| 93 | 93 | { |
| 94 | - if ($this->menu) return; |
|
| 94 | + if ($this->menu) { |
|
| 95 | + return; |
|
| 96 | + } |
|
| 95 | 97 | |
| 96 | 98 | $this->menu = Menu::addTo($this, ['atk-topMenu fixed horizontal', 'element' => 'header'], ['TopMenu']); |
| 97 | 99 | |
@@ -144,7 +146,9 @@ discard block |
||
| 144 | 146 | |
| 145 | 147 | public function setMenuRight() |
| 146 | 148 | { |
| 147 | - if ($this->menuRight) return; |
|
| 149 | + if ($this->menuRight) { |
|
| 150 | + return; |
|
| 151 | + } |
|
| 148 | 152 | |
| 149 | 153 | $this->menuRight = $this->menu->add(new View\RightMenu([ |
| 150 | 154 | 'ui' => false |
@@ -153,11 +157,15 @@ discard block |
||
| 153 | 157 | |
| 154 | 158 | public function setMenuLeft() |
| 155 | 159 | { |
| 156 | - if ($this->menuLeft) return; |
|
| 160 | + if ($this->menuLeft) { |
|
| 161 | + return; |
|
| 162 | + } |
|
| 157 | 163 | |
| 158 | 164 | $this->menuLeft = View\NavMenu::addTo($this, 'left vertical labeled sidebar', ['LeftMenu']); |
| 159 | 165 | |
| 160 | - if (! $this->burger) return; |
|
| 166 | + if (! $this->burger) { |
|
| 167 | + return; |
|
| 168 | + } |
|
| 161 | 169 | |
| 162 | 170 | $this->isMenuLeftVisible = $this->learn('menu', $this->isMenuLeftVisible); |
| 163 | 171 | |
@@ -173,7 +181,9 @@ discard block |
||
| 173 | 181 | |
| 174 | 182 | public function setActionBar() |
| 175 | 183 | { |
| 176 | - if ($this->actionBar) return; |
|
| 184 | + if ($this->actionBar) { |
|
| 185 | + return; |
|
| 186 | + } |
|
| 177 | 187 | |
| 178 | 188 | $this->actionBar = View\ActionBar::addTo($this, [], ['ActionBar']); |
| 179 | 189 | |
@@ -21,7 +21,9 @@ discard block |
||
| 21 | 21 | // make sure the installation information is fresh |
| 22 | 22 | ModuleManager::clearCache(); |
| 23 | 23 | |
| 24 | - if (SystemCore::isInstalled()) return redirect('home'); |
|
| 24 | + if (SystemCore::isInstalled()) { |
|
| 25 | + return redirect('home'); |
|
| 26 | + } |
|
| 25 | 27 | |
| 26 | 28 | $ui->title = __(':epesi > Installation', ['epesi' => config('epesi.ui.title')]); |
| 27 | 29 | |
@@ -65,7 +67,9 @@ discard block |
||
| 65 | 67 | } |
| 66 | 68 | } |
| 67 | 69 | |
| 68 | - if (! $view) abort(404); |
|
| 70 | + if (! $view) { |
|
| 71 | + abort(404); |
|
| 72 | + } |
|
| 69 | 73 | |
| 70 | 74 | $location = $ui->add($view)->displayModuleContent($method, $args)->location(); |
| 71 | 75 | |
@@ -11,64 +11,64 @@ |
||
| 11 | 11 | |
| 12 | 12 | class Controller extends BaseController |
| 13 | 13 | { |
| 14 | - public function index() |
|
| 15 | - { |
|
| 16 | - return SystemCore::isInstalled()? redirect('home'): redirect('install'); |
|
| 17 | - } |
|
| 14 | + public function index() |
|
| 15 | + { |
|
| 16 | + return SystemCore::isInstalled()? redirect('home'): redirect('install'); |
|
| 17 | + } |
|
| 18 | 18 | |
| 19 | - public function install(UI $ui) |
|
| 20 | - { |
|
| 21 | - // make sure the installation information is fresh |
|
| 22 | - ModuleManager::clearCache(); |
|
| 19 | + public function install(UI $ui) |
|
| 20 | + { |
|
| 21 | + // make sure the installation information is fresh |
|
| 22 | + ModuleManager::clearCache(); |
|
| 23 | 23 | |
| 24 | - if (SystemCore::isInstalled()) return redirect('home'); |
|
| 24 | + if (SystemCore::isInstalled()) return redirect('home'); |
|
| 25 | 25 | |
| 26 | - $ui->title = __(':epesi > Installation', ['epesi' => config('epesi.ui.title')]); |
|
| 26 | + $ui->title = __(':epesi > Installation', ['epesi' => config('epesi.ui.title')]); |
|
| 27 | 27 | |
| 28 | - $ui->initLayout(new Layout\Centered()); |
|
| 28 | + $ui->initLayout(new Layout\Centered()); |
|
| 29 | 29 | |
| 30 | - $ui->layout->set('logo', url('logo')); |
|
| 31 | - $ui->layout->template->dangerouslySetHTML('copyright', config('epesi.ui.copyright')); |
|
| 30 | + $ui->layout->set('logo', url('logo')); |
|
| 31 | + $ui->layout->template->dangerouslySetHTML('copyright', config('epesi.ui.copyright')); |
|
| 32 | 32 | |
| 33 | - $ui->add(new \Epesi\Core\System\SystemInstallWizard()); |
|
| 33 | + $ui->add(new \Epesi\Core\System\SystemInstallWizard()); |
|
| 34 | 34 | |
| 35 | - return $ui->response(); |
|
| 36 | - } |
|
| 35 | + return $ui->response(); |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | - public function home() |
|
| 39 | - { |
|
| 40 | - return redirect(SystemCore::isInstalled()? HomePage\Model\HomePage::pathOfUser(): 'install'); |
|
| 41 | - } |
|
| 38 | + public function home() |
|
| 39 | + { |
|
| 40 | + return redirect(SystemCore::isInstalled()? HomePage\Model\HomePage::pathOfUser(): 'install'); |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | - public function logo() |
|
| 44 | - { |
|
| 45 | - $logoFile = \Epesi\Core\System\Logo\LogoSettings::getLogoFile(); |
|
| 43 | + public function logo() |
|
| 44 | + { |
|
| 45 | + $logoFile = \Epesi\Core\System\Logo\LogoSettings::getLogoFile(); |
|
| 46 | 46 | |
| 47 | - return response(File::get($logoFile), 200, ['Content-type' => File::mimeType($logoFile)])->setMaxAge(604800)->setPublic(); |
|
| 48 | - } |
|
| 47 | + return response(File::get($logoFile), 200, ['Content-type' => File::mimeType($logoFile)])->setMaxAge(604800)->setPublic(); |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | - public function view(UI $ui, $module, $method = 'body', $args = []) |
|
| 51 | - { |
|
| 52 | - $ui->initLayout(new LayoutView()); |
|
| 50 | + public function view(UI $ui, $module, $method = 'body', $args = []) |
|
| 51 | + { |
|
| 52 | + $ui->initLayout(new LayoutView()); |
|
| 53 | 53 | |
| 54 | - $alias = explode(':', $module); |
|
| 54 | + $alias = explode(':', $module); |
|
| 55 | 55 | |
| 56 | - $moduleAlias = $alias[0]; |
|
| 57 | - $viewAlias = $alias[1]?? null; |
|
| 56 | + $moduleAlias = $alias[0]; |
|
| 57 | + $viewAlias = $alias[1]?? null; |
|
| 58 | 58 | |
| 59 | - $view = null; |
|
| 60 | - if ($module = ModuleManager::getClass($moduleAlias, true)) { |
|
| 61 | - $viewClass = $module::view($viewAlias); |
|
| 59 | + $view = null; |
|
| 60 | + if ($module = ModuleManager::getClass($moduleAlias, true)) { |
|
| 61 | + $viewClass = $module::view($viewAlias); |
|
| 62 | 62 | |
| 63 | - if (class_exists($viewClass)) { |
|
| 64 | - $view = [$viewClass]; |
|
| 65 | - } |
|
| 66 | - } |
|
| 63 | + if (class_exists($viewClass)) { |
|
| 64 | + $view = [$viewClass]; |
|
| 65 | + } |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | - if (! $view) abort(404); |
|
| 68 | + if (! $view) abort(404); |
|
| 69 | 69 | |
| 70 | - $location = $ui->add($view)->displayModuleContent($method, $args)->location(); |
|
| 70 | + $location = $ui->add($view)->displayModuleContent($method, $args)->location(); |
|
| 71 | 71 | |
| 72 | - return $ui->setLocation($location)->response(); |
|
| 73 | - } |
|
| 72 | + return $ui->setLocation($location)->response(); |
|
| 73 | + } |
|
| 74 | 74 | } |
@@ -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(UI $ui) |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | public function home() |
| 39 | 39 | { |
| 40 | - return redirect(SystemCore::isInstalled()? HomePage\Model\HomePage::pathOfUser(): 'install'); |
|
| 40 | + return redirect(SystemCore::isInstalled() ? HomePage\Model\HomePage::pathOfUser() : 'install'); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | public function logo() |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | $alias = explode(':', $module); |
| 55 | 55 | |
| 56 | 56 | $moduleAlias = $alias[0]; |
| 57 | - $viewAlias = $alias[1]?? null; |
|
| 57 | + $viewAlias = $alias[1] ?? null; |
|
| 58 | 58 | |
| 59 | 59 | $view = null; |
| 60 | 60 | if ($module = ModuleManager::getClass($moduleAlias, true)) { |
@@ -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 | $location = $ui->add($view)->displayModuleContent($method, $args)->location(); |
| 71 | 71 | |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | $accordion = \atk4\ui\Accordion::addTo($container, ['type' => ['styled', 'fluid'], 'settings' => ['animateChildren' => false]])->setStyle(['max-width' => '800px', 'margin-left' => 'auto', 'margin-right' => 'auto']); |
| 43 | 43 | |
| 44 | 44 | if ($container == $this) { |
| 45 | - $this->accordion = $accordion; |
|
| 45 | + $this->accordion = $accordion; |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | foreach ($modules as $moduleClass) { |
@@ -100,8 +100,8 @@ discard block |
||
| 100 | 100 | $message = ob_get_clean(); |
| 101 | 101 | |
| 102 | 102 | return [ |
| 103 | - $this->notifySuccess($message), |
|
| 104 | - new \atk4\ui\JsReload($this->accordion), |
|
| 103 | + $this->notifySuccess($message), |
|
| 104 | + new \atk4\ui\JsReload($this->accordion), |
|
| 105 | 105 | ]; |
| 106 | 106 | }); |
| 107 | 107 | |
@@ -152,14 +152,14 @@ discard block |
||
| 152 | 152 | $button = \atk4\ui\Button::addTo($container, [__('Uninstall'), 'class' => ['red']]); |
| 153 | 153 | |
| 154 | 154 | $callback = $uninstallCallback = \atk4\ui\JsCallback::addTo($button, ['confirm' => __('Are you sure you want to uninstall :module', ['module' => $moduleClass::label()])])->set(function() use ($moduleClass) { |
| 155 | - ob_start(); |
|
| 155 | + ob_start(); |
|
| 156 | 156 | ModuleManager::uninstall($moduleClass); |
| 157 | 157 | |
| 158 | 158 | $message = ob_get_clean(); |
| 159 | 159 | |
| 160 | 160 | return [ |
| 161 | - $this->notifySuccess($message), |
|
| 162 | - new \atk4\ui\JsReload($this->accordion), |
|
| 161 | + $this->notifySuccess($message), |
|
| 162 | + new \atk4\ui\JsReload($this->accordion), |
|
| 163 | 163 | ]; |
| 164 | 164 | }); |
| 165 | 165 | |
@@ -194,12 +194,12 @@ discard block |
||
| 194 | 194 | |
| 195 | 195 | public function addClearCacheButton() |
| 196 | 196 | { |
| 197 | - ActionBar::addItemButton([__('Clear Cache'), 'icon' => 'refresh', 'hint' => __('Clears module cache and re-discovers all available modules')])->callback(function($callback) { |
|
| 197 | + ActionBar::addItemButton([__('Clear Cache'), 'icon' => 'refresh', 'hint' => __('Clears module cache and re-discovers all available modules')])->callback(function($callback) { |
|
| 198 | 198 | ModuleManager::clearCache(); |
| 199 | 199 | |
| 200 | 200 | return [ |
| 201 | 201 | new \atk4\ui\JsReload($this->accordion), |
| 202 | - $this->notifySuccess(__('Cache cleared!')) |
|
| 202 | + $this->notifySuccess(__('Cache cleared!')) |
|
| 203 | 203 | ]; |
| 204 | 204 | }); |
| 205 | 205 | } |
@@ -30,8 +30,8 @@ discard block |
||
| 30 | 30 | { |
| 31 | 31 | $modules = ModuleManager::getAll(); |
| 32 | 32 | |
| 33 | - return $modules->filter(function ($subModuleClass) use ($modules) { |
|
| 34 | - return ! $modules->map(function($moduleClass){ |
|
| 33 | + return $modules->filter(function($subModuleClass) use ($modules) { |
|
| 34 | + return !$modules->map(function($moduleClass) { |
|
| 35 | 35 | return $moduleClass::namespace(); |
| 36 | 36 | })->contains($subModuleClass::parentNamespace()); |
| 37 | 37 | })->sort(); |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | $section->add($label, 'title')->setStyle('float', 'right'); |
| 67 | 67 | |
| 68 | - $submodules = ModuleManager::getAll()->filter(function ($subModuleClass) use ($moduleClass) { |
|
| 68 | + $submodules = ModuleManager::getAll()->filter(function($subModuleClass) use ($moduleClass) { |
|
| 69 | 69 | return $subModuleClass::isSubModuleOf($moduleClass); |
| 70 | 70 | }); |
| 71 | 71 | |
@@ -79,11 +79,11 @@ discard block |
||
| 79 | 79 | |
| 80 | 80 | public function formatModuleInfo($moduleClass) |
| 81 | 81 | { |
| 82 | - $moduleInfo = (array) ($moduleClass::info()?: __(' No details provided by author')); |
|
| 82 | + $moduleInfo = (array) ($moduleClass::info() ?: __(' No details provided by author')); |
|
| 83 | 83 | |
| 84 | 84 | $ret = []; |
| 85 | 85 | foreach ($moduleInfo as $label => $text) { |
| 86 | - $ret[] = (is_string($label)? "<strong>$label</strong>: ": '') . $text; |
|
| 86 | + $ret[] = (is_string($label) ? "<strong>$label</strong>: " : '') . $text; |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | return implode('<br>', $ret); |
@@ -123,12 +123,12 @@ discard block |
||
| 123 | 123 | |
| 124 | 124 | $form = Form::addTo($view); |
| 125 | 125 | foreach ($recommended as $childModule) { |
| 126 | - if (! ModuleManager::isAvailable($childModule)) continue; |
|
| 126 | + if (!ModuleManager::isAvailable($childModule)) continue; |
|
| 127 | 127 | |
| 128 | 128 | $form->addControl($childModule::alias(), ['CheckBox', 'caption' => $childModule::label()]); |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | - $form->onSubmit(function ($form) use ($moduleClass) { |
|
| 131 | + $form->onSubmit(function($form) use ($moduleClass) { |
|
| 132 | 132 | ob_start(); |
| 133 | 133 | ModuleManager::install($moduleClass, array_keys($form->getValues(), true)); |
| 134 | 134 | |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | \atk4\ui\Button::addTo($view, [__('Install'), 'primary'])->on('click', [ |
| 140 | - isset($form)? $form->submit(): $installCallback |
|
| 140 | + isset($form) ? $form->submit() : $installCallback |
|
| 141 | 141 | ]); |
| 142 | 142 | }); |
| 143 | 143 | |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | ]; |
| 164 | 164 | }); |
| 165 | 165 | |
| 166 | - if ($dependents = ModuleManager::listDependents()[$moduleClass]?? []) { |
|
| 166 | + if ($dependents = ModuleManager::listDependents()[$moduleClass] ?? []) { |
|
| 167 | 167 | $modal = \atk4\ui\Modal::addTo($this, ['title' => __(':module Module Installation', ['module' => $moduleClass::label()])])->set(function($view) use ($moduleClass, $dependents, $uninstallCallback) { |
| 168 | 168 | $message = \atk4\ui\Message::addTo($view, [__('Module is required by following modules')]); |
| 169 | 169 | |
@@ -56,8 +56,7 @@ discard block |
||
| 56 | 56 | $this->addUninstallButton($section, $moduleClass); |
| 57 | 57 | |
| 58 | 58 | // $this->addReinstallButton($section, $moduleClass); |
| 59 | - } |
|
| 60 | - else { |
|
| 59 | + } else { |
|
| 61 | 60 | $label = [\atk4\ui\Label::class, __('Available'), 'yellow']; |
| 62 | 61 | |
| 63 | 62 | $this->addInstallButton($section, $moduleClass); |
@@ -69,7 +68,9 @@ discard block |
||
| 69 | 68 | return $subModuleClass::isSubModuleOf($moduleClass); |
| 70 | 69 | }); |
| 71 | 70 | |
| 72 | - if ($submodules->isEmpty()) continue; |
|
| 71 | + if ($submodules->isEmpty()) { |
|
| 72 | + continue; |
|
| 73 | + } |
|
| 73 | 74 | |
| 74 | 75 | $this->addAccordion($section, $submodules); |
| 75 | 76 | } |
@@ -123,7 +124,9 @@ discard block |
||
| 123 | 124 | |
| 124 | 125 | $form = Form::addTo($view); |
| 125 | 126 | foreach ($recommended as $childModule) { |
| 126 | - if (! ModuleManager::isAvailable($childModule)) continue; |
|
| 127 | + if (! ModuleManager::isAvailable($childModule)) { |
|
| 128 | + continue; |
|
| 129 | + } |
|
| 127 | 130 | |
| 128 | 131 | $form->addControl($childModule::alias(), ['CheckBox', 'caption' => $childModule::label()]); |
| 129 | 132 | } |
@@ -28,10 +28,10 @@ |
||
| 28 | 28 | final public function displayModuleContent($method, $args) |
| 29 | 29 | { |
| 30 | 30 | // if method not callbale abort to 'not found' |
| 31 | - if (! is_callable([$this, $method])) abort(404); |
|
| 31 | + if (!is_callable([$this, $method])) abort(404); |
|
| 32 | 32 | |
| 33 | 33 | // if user has no access abort 'no access' |
| 34 | - if (! $this->access()) abort(401); |
|
| 34 | + if (!$this->access()) abort(401); |
|
| 35 | 35 | |
| 36 | 36 | $args = $this->decodeArgs($args); |
| 37 | 37 | |
@@ -28,10 +28,14 @@ |
||
| 28 | 28 | final public function displayModuleContent($method, $args) |
| 29 | 29 | { |
| 30 | 30 | // if method not callbale abort to 'not found' |
| 31 | - if (! is_callable([$this, $method])) abort(404); |
|
| 31 | + if (! is_callable([$this, $method])) { |
|
| 32 | + abort(404); |
|
| 33 | + } |
|
| 32 | 34 | |
| 33 | 35 | // if user has no access abort 'no access' |
| 34 | - if (! $this->access()) abort(401); |
|
| 36 | + if (! $this->access()) { |
|
| 37 | + abort(401); |
|
| 38 | + } |
|
| 35 | 39 | |
| 36 | 40 | $args = $this->decodeArgs($args); |
| 37 | 41 | |
@@ -4,24 +4,24 @@ |
||
| 4 | 4 | |
| 5 | 5 | trait Notifies |
| 6 | 6 | { |
| 7 | - public function notify($options) |
|
| 8 | - { |
|
| 9 | - $options = array_merge(['duration'=> 1500], is_array($options)? $options: ['message' => $options]); |
|
| 7 | + public function notify($options) |
|
| 8 | + { |
|
| 9 | + $options = array_merge(['duration'=> 1500], is_array($options)? $options: ['message' => $options]); |
|
| 10 | 10 | |
| 11 | - return new \atk4\ui\JsToast($options); |
|
| 12 | - } |
|
| 11 | + return new \atk4\ui\JsToast($options); |
|
| 12 | + } |
|
| 13 | 13 | |
| 14 | - public function notifySuccess($options) |
|
| 15 | - { |
|
| 16 | - $options = array_merge(['class' => 'success'], is_array($options)? $options: ['message' => $options]); |
|
| 14 | + public function notifySuccess($options) |
|
| 15 | + { |
|
| 16 | + $options = array_merge(['class' => 'success'], is_array($options)? $options: ['message' => $options]); |
|
| 17 | 17 | |
| 18 | - return $this->notify($options); |
|
| 19 | - } |
|
| 18 | + return $this->notify($options); |
|
| 19 | + } |
|
| 20 | 20 | |
| 21 | - public function notifyError($options) |
|
| 22 | - { |
|
| 23 | - $options = array_merge(['class' => 'error'], is_array($options)? $options: ['message' => $options]); |
|
| 21 | + public function notifyError($options) |
|
| 22 | + { |
|
| 23 | + $options = array_merge(['class' => 'error'], is_array($options)? $options: ['message' => $options]); |
|
| 24 | 24 | |
| 25 | - return $this->notify($options); |
|
| 26 | - } |
|
| 25 | + return $this->notify($options); |
|
| 26 | + } |
|
| 27 | 27 | } |
| 28 | 28 | \ No newline at end of file |
@@ -6,21 +6,21 @@ |
||
| 6 | 6 | { |
| 7 | 7 | public function notify($options) |
| 8 | 8 | { |
| 9 | - $options = array_merge(['duration'=> 1500], is_array($options)? $options: ['message' => $options]); |
|
| 9 | + $options = array_merge(['duration'=> 1500], is_array($options) ? $options : ['message' => $options]); |
|
| 10 | 10 | |
| 11 | 11 | return new \atk4\ui\JsToast($options); |
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | public function notifySuccess($options) |
| 15 | 15 | { |
| 16 | - $options = array_merge(['class' => 'success'], is_array($options)? $options: ['message' => $options]); |
|
| 16 | + $options = array_merge(['class' => 'success'], is_array($options) ? $options : ['message' => $options]); |
|
| 17 | 17 | |
| 18 | 18 | return $this->notify($options); |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | public function notifyError($options) |
| 22 | 22 | { |
| 23 | - $options = array_merge(['class' => 'error'], is_array($options)? $options: ['message' => $options]); |
|
| 23 | + $options = array_merge(['class' => 'error'], is_array($options) ? $options : ['message' => $options]); |
|
| 24 | 24 | |
| 25 | 25 | return $this->notify($options); |
| 26 | 26 | } |