@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | class CommonDataSettings extends ModuleView |
12 | 12 | { |
13 | - use SessionTrait; |
|
13 | + use SessionTrait; |
|
14 | 14 | |
15 | 15 | protected $label = 'Common Data'; |
16 | 16 | |
@@ -36,23 +36,23 @@ discard block |
||
36 | 36 | |
37 | 37 | public function setAncestors() |
38 | 38 | { |
39 | - $parent = $this->stickyGet('parent'); |
|
39 | + $parent = $this->stickyGet('parent'); |
|
40 | 40 | |
41 | - if (isset($parent)) { |
|
42 | - $this->memorize('parent', $parent?: null); |
|
43 | - } |
|
41 | + if (isset($parent)) { |
|
42 | + $this->memorize('parent', $parent?: null); |
|
43 | + } |
|
44 | 44 | |
45 | - $this->ancestors = Models\CommonData::ancestorsAndSelf($this->recall('parent')); |
|
45 | + $this->ancestors = Models\CommonData::ancestorsAndSelf($this->recall('parent')); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | public function setLocation() |
49 | 49 | { |
50 | - $location = [['label' => $this->label, 'link' => '?parent=0']]; |
|
50 | + $location = [['label' => $this->label, 'link' => '?parent=0']]; |
|
51 | 51 | foreach (Models\CommonData::create()->withID($this->ancestors) as $node) { |
52 | - $location[] = [ |
|
53 | - 'label' => $node['value'] ?: $node['key'], |
|
54 | - 'link' => '?parent=' . $node['id'] |
|
55 | - ]; |
|
52 | + $location[] = [ |
|
53 | + 'label' => $node['value'] ?: $node['key'], |
|
54 | + 'link' => '?parent=' . $node['id'] |
|
55 | + ]; |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | $this->label = null; |
@@ -69,17 +69,17 @@ discard block |
||
69 | 69 | 'editFields' => ['key', 'value'], |
70 | 70 | 'addFields' => ['key', 'value'], |
71 | 71 | 'displayFields' => ['key', 'value', 'readonly'], |
72 | - 'notifyDefault' => ['jsToast', 'settings' => ['message' => __('Data is saved!'), 'class' => 'success']], |
|
72 | + 'notifyDefault' => ['jsToast', 'settings' => ['message' => __('Data is saved!'), 'class' => 'success']], |
|
73 | 73 | 'paginator' => false, |
74 | - 'menu' => ActionBar::instance(), |
|
75 | - 'quickSearch' => ['key', 'value'] |
|
74 | + 'menu' => ActionBar::instance(), |
|
75 | + 'quickSearch' => ['key', 'value'] |
|
76 | 76 | ]); |
77 | 77 | |
78 | 78 | $this->grid->setModel($this->nodes()->setOrder('position')); |
79 | 79 | |
80 | 80 | $this->grid->addActionButton(['icon' => 'level down', 'attr' => ['title' => __('Drilldown')]], new jsExpression( |
81 | - 'document.location=\'?parent=\'+[]', |
|
82 | - [$this->grid->jsRow()->data('id')] |
|
81 | + 'document.location=\'?parent=\'+[]', |
|
82 | + [$this->grid->jsRow()->data('id')] |
|
83 | 83 | )); |
84 | 84 | |
85 | 85 | $this->grid->addDragHandler()->onReorder(function ($order) { |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | }); |
95 | 95 | |
96 | 96 | if ($this->ancestors && $this->grid->menu) { |
97 | - $this->grid->menu->addItem([__('Level Up'), 'icon' => 'level up'], '?parent=' . $this->parent(1)); |
|
97 | + $this->grid->menu->addItem([__('Level Up'), 'icon' => 'level up'], '?parent=' . $this->parent(1)); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | return $this; |
@@ -102,23 +102,23 @@ discard block |
||
102 | 102 | |
103 | 103 | public function parent($level = 0) |
104 | 104 | { |
105 | - return $this->ancestors[$level] ?? null; |
|
105 | + return $this->ancestors[$level] ?? null; |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | public function nodes() |
109 | 109 | { |
110 | - $nodes = Models\CommonData::create(); |
|
110 | + $nodes = Models\CommonData::create(); |
|
111 | 111 | |
112 | - $nodes->addCondition('parent', $this->parent()); |
|
112 | + $nodes->addCondition('parent', $this->parent()); |
|
113 | 113 | |
114 | - $nodes->addHook('beforeInsert', function($node, & $data) { |
|
115 | - $data['parent'] = $this->recall('parent'); |
|
116 | - }); |
|
114 | + $nodes->addHook('beforeInsert', function($node, & $data) { |
|
115 | + $data['parent'] = $this->recall('parent'); |
|
116 | + }); |
|
117 | 117 | |
118 | - $nodes->getAction('edit')->enabled = function($row = null) { |
|
119 | - return $row ? !$row['readonly'] : true; |
|
120 | - }; |
|
118 | + $nodes->getAction('edit')->enabled = function($row = null) { |
|
119 | + return $row ? !$row['readonly'] : true; |
|
120 | + }; |
|
121 | 121 | |
122 | - return $nodes; |
|
122 | + return $nodes; |
|
123 | 123 | } |
124 | 124 | } |