@@ -142,7 +142,9 @@ discard block |
||
| 142 | 142 | |
| 143 | 143 | public function addMenu() |
| 144 | 144 | { |
| 145 | - if ($this->isLocked()) return; |
|
| 145 | + if ($this->isLocked()) { |
|
| 146 | + return; |
|
| 147 | + } |
|
| 146 | 148 | |
| 147 | 149 | $dashboardId = $this->dashboard()->id; |
| 148 | 150 | |
@@ -165,14 +167,18 @@ discard block |
||
| 165 | 167 | $dashboardMenu->addItem([__('Rename dashboard'), 'icon' => 'i cursor'])->on('click', $modal->show()); |
| 166 | 168 | |
| 167 | 169 | // there is only one admin default dashboard |
| 168 | - if ($this->admin) return; |
|
| 170 | + if ($this->admin) { |
|
| 171 | + return; |
|
| 172 | + } |
|
| 169 | 173 | |
| 170 | 174 | // ***** add ***** // |
| 171 | 175 | $modal = $this->add(['Modal', 'title' => __('Add Dashboard')])->set(\Closure::fromCallable([$this, 'addDashboard'])); |
| 172 | 176 | |
| 173 | 177 | $dashboardMenu->addItem([__('Add dashboard'), 'icon' => 'add'])->on('click', $modal->show()); |
| 174 | 178 | |
| 175 | - if ($this->isSingleDashboard()) return; |
|
| 179 | + if ($this->isSingleDashboard()) { |
|
| 180 | + return; |
|
| 181 | + } |
|
| 176 | 182 | |
| 177 | 183 | // ***** reorder ***** // |
| 178 | 184 | $modal = $this->add(['Modal', 'title' => __('Reorder Dashboards')])->set(\Closure::fromCallable([$this, 'reorderDashboards'])); |
@@ -26,8 +26,7 @@ |
||
| 26 | 26 | |
| 27 | 27 | if ($this->admin) { |
| 28 | 28 | $this->set($joint->info())->setAttr('searchkey', strtolower($joint->caption() . ';' . $joint->info())); |
| 29 | - } |
|
| 30 | - else { |
|
| 29 | + } else { |
|
| 31 | 30 | if (! $this->locked) { |
| 32 | 31 | $this->addControl('close', 'applet-close')->setAttr('title', __('Close applet')); |
| 33 | 32 | } |
@@ -31,7 +31,9 @@ |
||
| 31 | 31 | { |
| 32 | 32 | // create user default dashboard as copy of the system default |
| 33 | 33 | User::created(function(User $user) { |
| 34 | - if (! $defaultDashboard = Dashboard::where('user_id', 0)->first()) return; |
|
| 34 | + if (! $defaultDashboard = Dashboard::where('user_id', 0)->first()) { |
|
| 35 | + return; |
|
| 36 | + } |
|
| 35 | 37 | |
| 36 | 38 | $userDefaultDashboard = $defaultDashboard->replicate(); |
| 37 | 39 | |
@@ -19,7 +19,10 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | $parentId = null; |
| 21 | 21 | foreach(explode('/', trim($path,'/')) as $nodeKey) { |
| 22 | - if ($nodeKey === '') continue; //ignore empty paths |
|
| 22 | + if ($nodeKey === '') { |
|
| 23 | + continue; |
|
| 24 | + } |
|
| 25 | + //ignore empty paths |
|
| 23 | 26 | |
| 24 | 27 | if (empty($cache[$parentId][$nodeKey])) { |
| 25 | 28 | if (! $node = self::where('parent_id', $parentId)->where('key', $nodeKey)->first()) { |
@@ -37,11 +40,15 @@ discard block |
||
| 37 | 40 | |
| 38 | 41 | public static function newId($path, $readonly = false) |
| 39 | 42 | { |
| 40 | - if (! $path = trim($path,'/')) return false; |
|
| 43 | + if (! $path = trim($path,'/')) { |
|
| 44 | + return false; |
|
| 45 | + } |
|
| 41 | 46 | |
| 42 | 47 | $id = $parentId = null; |
| 43 | 48 | foreach(explode('/', $path) as $nodeKey) { |
| 44 | - if ($nodeKey === '') continue; |
|
| 49 | + if ($nodeKey === '') { |
|
| 50 | + continue; |
|
| 51 | + } |
|
| 45 | 52 | |
| 46 | 53 | if (! $node = self::where('parent_id', $parentId)->where('key', $nodeKey)->first()) { |
| 47 | 54 | $node = self::create([ |
@@ -61,9 +68,13 @@ discard block |
||
| 61 | 68 | public static function setValue($path, $value, $overwrite = true, $readonly = false) |
| 62 | 69 | { |
| 63 | 70 | if (! $id = self::getId($path)) { |
| 64 | - if (! $id = self::newId($path, $readonly)) return false; |
|
| 71 | + if (! $id = self::newId($path, $readonly)) { |
|
| 72 | + return false; |
|
| 73 | + } |
|
| 65 | 74 | } else { |
| 66 | - if (! $overwrite) return false; |
|
| 75 | + if (! $overwrite) { |
|
| 76 | + return false; |
|
| 77 | + } |
|
| 67 | 78 | } |
| 68 | 79 | |
| 69 | 80 | self::find($id)->update(compact('value', 'readonly')); |
@@ -78,7 +89,9 @@ discard block |
||
| 78 | 89 | $key = md5(serialize([$path, $translate])); |
| 79 | 90 | |
| 80 | 91 | if (! isset($cache[$key])) { |
| 81 | - if(! $id = self::getId($path)) return false; |
|
| 92 | + if(! $id = self::getId($path)) { |
|
| 93 | + return false; |
|
| 94 | + } |
|
| 82 | 95 | |
| 83 | 96 | $ret = self::find($id)->value; |
| 84 | 97 | |
@@ -112,7 +125,9 @@ discard block |
||
| 112 | 125 | self::find($id)->delete(); |
| 113 | 126 | } |
| 114 | 127 | |
| 115 | - if(! $id = self::newId($path, $readonly)) return false; |
|
| 128 | + if(! $id = self::newId($path, $readonly)) { |
|
| 129 | + return false; |
|
| 130 | + } |
|
| 116 | 131 | |
| 117 | 132 | if ($overwrite) { |
| 118 | 133 | self::find($id)->update(compact('readonly')); |
@@ -165,7 +180,9 @@ discard block |
||
| 165 | 180 | * @return true on success, false otherwise |
| 166 | 181 | */ |
| 167 | 182 | public static function deleteArray($path){ |
| 168 | - if (! $id = self::getId($path, true)) return false; |
|
| 183 | + if (! $id = self::getId($path, true)) { |
|
| 184 | + return false; |
|
| 185 | + } |
|
| 169 | 186 | |
| 170 | 187 | self::find($id)->delete(); |
| 171 | 188 | } |
@@ -185,7 +202,9 @@ discard block |
||
| 185 | 202 | } |
| 186 | 203 | |
| 187 | 204 | if (! $id = self::getId($path)) { |
| 188 | - if ($silent) return collection(); |
|
| 205 | + if ($silent) { |
|
| 206 | + return collection(); |
|
| 207 | + } |
|
| 189 | 208 | |
| 190 | 209 | new \Exception('Invalid CommonData::getArray() request: ' . $path); |
| 191 | 210 | } |
@@ -196,7 +215,9 @@ discard block |
||
| 196 | 215 | protected static function validateArrayKeys($array) |
| 197 | 216 | { |
| 198 | 217 | foreach($array as $key => $value) { |
| 199 | - if (strpos($key, '/') === false) continue; |
|
| 218 | + if (strpos($key, '/') === false) { |
|
| 219 | + continue; |
|
| 220 | + } |
|
| 200 | 221 | |
| 201 | 222 | \Exception('Invalid common data key: '. $key); |
| 202 | 223 | } |
@@ -112,7 +112,9 @@ |
||
| 112 | 112 | |
| 113 | 113 | public function getControlButtonsHtml($row) |
| 114 | 114 | { |
| 115 | - if ($row['readonly']) return ''; |
|
| 115 | + if ($row['readonly']) { |
|
| 116 | + return ''; |
|
| 117 | + } |
|
| 116 | 118 | |
| 117 | 119 | $ret = ''; |
| 118 | 120 | foreach ($this->buttons as $button) { |