@@ -15,8 +15,8 @@ |
||
15 | 15 | foreach ($templates['app']['installed'] as $template => $name) { |
16 | 16 | $table->addRow([ |
17 | 17 | $name, |
18 | - (empty($templates['app']['current']) || $templates['app']['current'] != $template) ? '<a href = "/admin/view/setDefault/' . $template . '">Установить по умолчанию</a>' : 'Тема по умолчанию', |
|
19 | - '<a href = "/admin/view/template/editFile/' . $template . '">Файлы</a> <a href = "/admin/view/editTemplate/' . $template . '">Редактировать</a>' |
|
18 | + (empty($templates['app']['current']) || $templates['app']['current'] != $template) ? '<a href = "/admin/view/setDefault/'.$template.'">Установить по умолчанию</a>' : 'Тема по умолчанию', |
|
19 | + '<a href = "/admin/view/template/editFile/'.$template.'">Файлы</a> <a href = "/admin/view/editTemplate/'.$template.'">Редактировать</a>' |
|
20 | 20 | ]); |
21 | 21 | } |
22 | 22 | $table->draw(); |
23 | 23 | \ No newline at end of file |
@@ -3,9 +3,9 @@ |
||
3 | 3 | <hr/> |
4 | 4 | <?php |
5 | 5 | foreach ($template->config['css'] as $file) { |
6 | - if (file_exists($template->path . '/css/' . $file)) { |
|
6 | + if (file_exists($template->path.'/css/'.$file)) { |
|
7 | 7 | ?> |
8 | - <a href ='/admin/view/template/editFile/<?= $template->name; ?>?path=<?= 'css/' . $file; ?>'><?= $file; ?></a> |
|
8 | + <a href ='/admin/view/template/editFile/<?= $template->name; ?>?path=<?= 'css/'.$file; ?>'><?= $file; ?></a> |
|
9 | 9 | <?php |
10 | 10 | } |
11 | 11 | } |
@@ -22,15 +22,15 @@ |
||
22 | 22 | function editFileAction($templateName) |
23 | 23 | { |
24 | 24 | $template = \View\Template::get($templateName, \App::$primary); |
25 | - if (!empty($_GET['path']) && file_exists($template->path . '/' . Tools::parsePath($_GET['path']))) { |
|
25 | + if (!empty($_GET['path']) && file_exists($template->path.'/'.Tools::parsePath($_GET['path']))) { |
|
26 | 26 | $code = file_get_contents("php://input"); |
27 | 27 | if (!empty($code)) { |
28 | 28 | $result = new Server\Result(); |
29 | 29 | $result->successMsg = 'Файл сохранен'; |
30 | - $content = file_put_contents($template->path . '/' . Tools::parsePath($_GET['path']), $code); |
|
30 | + $content = file_put_contents($template->path.'/'.Tools::parsePath($_GET['path']), $code); |
|
31 | 31 | $result->send(); |
32 | 32 | } |
33 | - $content = file_get_contents($template->path . '/' . Tools::parsePath($_GET['path'])); |
|
33 | + $content = file_get_contents($template->path.'/'.Tools::parsePath($_GET['path'])); |
|
34 | 34 | $this->libs->loadLib('Ace'); |
35 | 35 | $this->view->page(['content' => 'template/edit', 'data' => compact('template', 'content')]); |
36 | 36 | } else { |
@@ -3,9 +3,9 @@ |
||
3 | 3 | <hr/> |
4 | 4 | <?php |
5 | 5 | foreach ($template->config['css'] as $file) { |
6 | - if (file_exists($template->path . '/css/' . $file)) { |
|
6 | + if (file_exists($template->path.'/css/'.$file)) { |
|
7 | 7 | ?> |
8 | - <a href ='/admin/view/template/editFile/<?= $template->name; ?>?path=<?= 'css/' . $file; ?>'><?= $file; ?></a> |
|
8 | + <a href ='/admin/view/template/editFile/<?= $template->name; ?>?path=<?= 'css/'.$file; ?>'><?= $file; ?></a> |
|
9 | 9 | <?php |
10 | 10 | } |
11 | 11 | } |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | $this->info = $this->getInfo(); |
73 | 73 | $this->config = Config::module($this->moduleName, !empty($this->info['systemConfig'])); |
74 | 74 | $that = $this; |
75 | - Inji::$inst->listen('Config-change-module-' . $this->app->name . '-' . $this->moduleName, $this->app->name . '-' . $this->moduleName . 'config', function($event) use ($that) { |
|
75 | + Inji::$inst->listen('Config-change-module-'.$this->app->name.'-'.$this->moduleName, $this->app->name.'-'.$this->moduleName.'config', function($event) use ($that) { |
|
76 | 76 | $that->config = $event['eventObject']; |
77 | 77 | }); |
78 | 78 | } |
@@ -88,10 +88,10 @@ discard block |
||
88 | 88 | $moduleName = ucfirst($moduleName); |
89 | 89 | $paths = []; |
90 | 90 | if (App::$cur !== App::$primary) { |
91 | - $paths['primaryAppPath'] = App::$primary->path . '/modules/' . $moduleName; |
|
91 | + $paths['primaryAppPath'] = App::$primary->path.'/modules/'.$moduleName; |
|
92 | 92 | } |
93 | - $paths['curAppPath'] = App::$cur->path . '/modules/' . $moduleName; |
|
94 | - $paths['systemPath'] = INJI_SYSTEM_DIR . '/modules/' . $moduleName; |
|
93 | + $paths['curAppPath'] = App::$cur->path.'/modules/'.$moduleName; |
|
94 | + $paths['systemPath'] = INJI_SYSTEM_DIR.'/modules/'.$moduleName; |
|
95 | 95 | return $paths; |
96 | 96 | } |
97 | 97 | |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | $moduleName = ucfirst($moduleName); |
107 | 107 | $paths = Module::getModulePaths($moduleName); |
108 | 108 | foreach ($paths as $path) { |
109 | - if (file_exists($path . '/' . $moduleName . '.php')) { |
|
109 | + if (file_exists($path.'/'.$moduleName.'.php')) { |
|
110 | 110 | return $path; |
111 | 111 | } |
112 | 112 | } |
@@ -159,12 +159,12 @@ discard block |
||
159 | 159 | foreach ($moduleDirs as $moduleDir) { |
160 | 160 | if (is_dir($moduleDir)) { |
161 | 161 | foreach (scandir($moduleDir) as $dir) { |
162 | - if (preg_match('!Controllers$!', $dir) && is_dir($moduleDir . '/' . $dir)) { |
|
163 | - $path = $moduleDir . '/' . $dir; |
|
162 | + if (preg_match('!Controllers$!', $dir) && is_dir($moduleDir.'/'.$dir)) { |
|
163 | + $path = $moduleDir.'/'.$dir; |
|
164 | 164 | foreach (scandir($path) as $file) { |
165 | - if (preg_match('!Controller\.php$!', $file) && is_file($path . '/' . $file)) { |
|
165 | + if (preg_match('!Controller\.php$!', $file) && is_file($path.'/'.$file)) { |
|
166 | 166 | $controllerName = preg_replace('!Controller\.php$!', '', $file); |
167 | - $controllers[preg_replace('!Controllers$!', '', $dir)][$controllerName] = $path . '/' . $file; |
|
167 | + $controllers[preg_replace('!Controllers$!', '', $dir)][$controllerName] = $path.'/'.$file; |
|
168 | 168 | } |
169 | 169 | } |
170 | 170 | } |
@@ -211,31 +211,31 @@ discard block |
||
211 | 211 | $paths = []; |
212 | 212 | if (App::$cur != App::$primary) { |
213 | 213 | if (!empty($this->params[0]) && strtolower($this->params[0]) != strtolower($this->moduleName)) { |
214 | - $paths['primaryAppAppTypePath_slice'] = App::$primary->path . '/modules/' . $this->moduleName . '/' . $this->app->type . 'Controllers/' . ucfirst($this->params[0]) . 'Controller.php'; |
|
214 | + $paths['primaryAppAppTypePath_slice'] = App::$primary->path.'/modules/'.$this->moduleName.'/'.$this->app->type.'Controllers/'.ucfirst($this->params[0]).'Controller.php'; |
|
215 | 215 | if (App::$primary->{$this->moduleName}) { |
216 | - $paths['primaryAppAppTypePath_slice'] = App::$primary->{$this->moduleName}->path . '/' . $this->app->type . 'Controllers/' . ucfirst($this->params[0]) . 'Controller.php'; |
|
216 | + $paths['primaryAppAppTypePath_slice'] = App::$primary->{$this->moduleName}->path.'/'.$this->app->type.'Controllers/'.ucfirst($this->params[0]).'Controller.php'; |
|
217 | 217 | } |
218 | 218 | } |
219 | - $paths['primaryAppAppAppTypePath'] = App::$primary->path . '/modules/' . $this->moduleName . '/' . $this->app->type . 'Controllers/' . $this->moduleName . 'Controller.php'; |
|
219 | + $paths['primaryAppAppAppTypePath'] = App::$primary->path.'/modules/'.$this->moduleName.'/'.$this->app->type.'Controllers/'.$this->moduleName.'Controller.php'; |
|
220 | 220 | if (App::$primary->{$this->moduleName}) { |
221 | - $paths['primaryAppAppTypePath'] = App::$primary->{$this->moduleName}->path . '/' . $this->app->type . 'Controllers/' . $this->moduleName . 'Controller.php'; |
|
221 | + $paths['primaryAppAppTypePath'] = App::$primary->{$this->moduleName}->path.'/'.$this->app->type.'Controllers/'.$this->moduleName.'Controller.php'; |
|
222 | 222 | } |
223 | - $paths['curAppAppTypePath'] = $this->app->{$this->moduleName}->path . '/' . $this->app->type . 'Controllers/' . $this->moduleName . 'Controller.php'; |
|
223 | + $paths['curAppAppTypePath'] = $this->app->{$this->moduleName}->path.'/'.$this->app->type.'Controllers/'.$this->moduleName.'Controller.php'; |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | if (!empty($this->params[0]) && strtolower($this->params[0]) != strtolower($this->moduleName)) { |
227 | - $paths['appAppTypePath_slice'] = $this->app->path . '/modules/' . $this->moduleName . '/' . $this->app->type . 'Controllers/' . ucfirst($this->params[0]) . 'Controller.php'; |
|
228 | - $paths['appTypePath_slice'] = $this->path . '/' . $this->app->type . 'Controllers/' . ucfirst($this->params[0]) . 'Controller.php'; |
|
227 | + $paths['appAppTypePath_slice'] = $this->app->path.'/modules/'.$this->moduleName.'/'.$this->app->type.'Controllers/'.ucfirst($this->params[0]).'Controller.php'; |
|
228 | + $paths['appTypePath_slice'] = $this->path.'/'.$this->app->type.'Controllers/'.ucfirst($this->params[0]).'Controller.php'; |
|
229 | 229 | } |
230 | - $paths['appAppTypePath'] = $this->app->path . '/modules/' . $this->moduleName . '/' . $this->app->type . 'Controllers/' . $this->moduleName . 'Controller.php'; |
|
231 | - $paths['appTypePath'] = $this->path . '/' . $this->app->type . 'Controllers/' . $this->moduleName . 'Controller.php'; |
|
230 | + $paths['appAppTypePath'] = $this->app->path.'/modules/'.$this->moduleName.'/'.$this->app->type.'Controllers/'.$this->moduleName.'Controller.php'; |
|
231 | + $paths['appTypePath'] = $this->path.'/'.$this->app->type.'Controllers/'.$this->moduleName.'Controller.php'; |
|
232 | 232 | |
233 | 233 | if (!empty($this->params[0]) && strtolower($this->params[0]) != strtolower($this->moduleName)) { |
234 | - $paths['appUniversalPath_slice'] = $this->app->path . '/modules/' . $this->moduleName . '/Controllers/' . ucfirst($this->params[0]) . 'Controller.php'; |
|
235 | - $paths['universalPath_slice'] = $this->path . '/Controllers/' . ucfirst($this->params[0]) . 'Controller.php'; |
|
234 | + $paths['appUniversalPath_slice'] = $this->app->path.'/modules/'.$this->moduleName.'/Controllers/'.ucfirst($this->params[0]).'Controller.php'; |
|
235 | + $paths['universalPath_slice'] = $this->path.'/Controllers/'.ucfirst($this->params[0]).'Controller.php'; |
|
236 | 236 | } |
237 | - $paths['appUniversalPath'] = $this->app->path . '/modules/' . $this->moduleName . '/Controllers/' . $this->moduleName . 'Controller.php'; |
|
238 | - $paths['universalPath'] = $this->path . '/Controllers/' . $this->moduleName . 'Controller.php'; |
|
237 | + $paths['appUniversalPath'] = $this->app->path.'/modules/'.$this->moduleName.'/Controllers/'.$this->moduleName.'Controller.php'; |
|
238 | + $paths['universalPath'] = $this->path.'/Controllers/'.$this->moduleName.'Controller.php'; |
|
239 | 239 | |
240 | 240 | return $paths; |
241 | 241 | } |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | $controllerName = $this->moduleName; |
259 | 259 | $params = $this->params; |
260 | 260 | } |
261 | - $fullControllerName = $controllerName . 'Controller'; |
|
261 | + $fullControllerName = $controllerName.'Controller'; |
|
262 | 262 | $controller = new $fullControllerName(); |
263 | 263 | $controller->params = $params; |
264 | 264 | $controller->module = $this; |
@@ -284,8 +284,8 @@ discard block |
||
284 | 284 | } |
285 | 285 | $paths = Module::getModulePaths($moduleName); |
286 | 286 | foreach ($paths as $path) { |
287 | - if (file_exists($path . '/info.php')) { |
|
288 | - return include $path . '/info.php'; |
|
287 | + if (file_exists($path.'/info.php')) { |
|
288 | + return include $path.'/info.php'; |
|
289 | 289 | } |
290 | 290 | } |
291 | 291 | return []; |
@@ -304,16 +304,16 @@ discard block |
||
304 | 304 | { |
305 | 305 | $moduleName = $moduleName ? $moduleName : $this->moduleName; |
306 | 306 | $modulePaths = Module::getModulePaths($moduleName); |
307 | - $modulePaths['templatePath'] = App::$cur->view->template->path . '/modules/' . ucfirst($moduleName); |
|
307 | + $modulePaths['templatePath'] = App::$cur->view->template->path.'/modules/'.ucfirst($moduleName); |
|
308 | 308 | $snippets = []; |
309 | 309 | foreach ($modulePaths as $path) { |
310 | - if (file_exists($path . $dir . '/' . $snippetsPath)) { |
|
311 | - $snippetsPaths = array_slice(scandir($path . $dir . '/' . $snippetsPath), 2); |
|
310 | + if (file_exists($path.$dir.'/'.$snippetsPath)) { |
|
311 | + $snippetsPaths = array_slice(scandir($path.$dir.'/'.$snippetsPath), 2); |
|
312 | 312 | foreach ($snippetsPaths as $snippetPath) { |
313 | - if (is_dir($path . $dir . '/' . $snippetsPath . '/' . $snippetPath)) { |
|
314 | - $snippets[$snippetPath] = include $path . $dir . '/' . $snippetsPath . '/' . $snippetPath . '/info.php'; |
|
313 | + if (is_dir($path.$dir.'/'.$snippetsPath.'/'.$snippetPath)) { |
|
314 | + $snippets[$snippetPath] = include $path.$dir.'/'.$snippetsPath.'/'.$snippetPath.'/info.php'; |
|
315 | 315 | } else { |
316 | - $snippets[pathinfo($snippetPath, PATHINFO_FILENAME)] = include $path . $dir . '/' . $snippetsPath . '/' . $snippetPath; |
|
316 | + $snippets[pathinfo($snippetPath, PATHINFO_FILENAME)] = include $path.$dir.'/'.$snippetsPath.'/'.$snippetPath; |
|
317 | 317 | } |
318 | 318 | } |
319 | 319 | } |
@@ -335,9 +335,9 @@ discard block |
||
335 | 335 | { |
336 | 336 | $extensions = []; |
337 | 337 | $modules = Module::getInstalled(App::$cur); |
338 | - $method = 'get' . ucfirst($extensionType); |
|
338 | + $method = 'get'.ucfirst($extensionType); |
|
339 | 339 | foreach ($modules as $module) { |
340 | - $extensions = array_merge($extensions, $this->{$method}($request, false, "/extensions/{$this->moduleName}/" . $extensionType, $module)); |
|
340 | + $extensions = array_merge($extensions, $this->{$method}($request, false, "/extensions/{$this->moduleName}/".$extensionType, $module)); |
|
341 | 341 | } |
342 | 342 | return $extensions; |
343 | 343 | } |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | $this->name = $this->managerOptions['name']; |
59 | 59 | } |
60 | 60 | |
61 | - $this->managerId = str_replace('\\', '_', 'dataManager_' . $this->modelName . '_' . $this->managerName . '_' . \Tools::randomString()); |
|
61 | + $this->managerId = str_replace('\\', '_', 'dataManager_'.$this->modelName.'_'.$this->managerName.'_'.\Tools::randomString()); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | /** |
@@ -102,13 +102,13 @@ discard block |
||
102 | 102 | if (!empty($this->managerOptions['filters'])) { |
103 | 103 | $buttons[] = [ |
104 | 104 | 'text' => 'Фильтры', |
105 | - 'onclick' => ' var modal = $("#' . $this->managerId . '_filters"); |
|
105 | + 'onclick' => ' var modal = $("#'.$this->managerId.'_filters"); |
|
106 | 106 | modal.modal("show");', |
107 | 107 | ]; |
108 | 108 | } |
109 | 109 | $buttons[] = [ |
110 | 110 | 'text' => 'Добавить элемент', |
111 | - 'onclick' => 'inji.Ui.forms.popUp("' . str_replace('\\', '\\\\', $modelName) . '",' . json_encode($formParams) . ')', |
|
111 | + 'onclick' => 'inji.Ui.forms.popUp("'.str_replace('\\', '\\\\', $modelName).'",'.json_encode($formParams).')', |
|
112 | 112 | ]; |
113 | 113 | |
114 | 114 | return $buttons; |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | 'className' => $action |
139 | 139 | ]; |
140 | 140 | } |
141 | - $return[$key]['className'] = strpos($return[$key]['className'], '\\') === false && class_exists('Ui\DataManager\Action\\' . $return[$key]['className']) ? 'Ui\DataManager\Action\\' . $return[$key]['className'] : $return[$key]['className']; |
|
141 | + $return[$key]['className'] = strpos($return[$key]['className'], '\\') === false && class_exists('Ui\DataManager\Action\\'.$return[$key]['className']) ? 'Ui\DataManager\Action\\'.$return[$key]['className'] : $return[$key]['className']; |
|
142 | 142 | if (!class_exists($return[$key]['className']) || ($onlyGroupActions && !$return[$key]['className']::$groupAction)) { |
143 | 143 | unset($return[$key]); |
144 | 144 | } |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | <?php |
171 | 171 | foreach ($actions as $action => $actionParams) { |
172 | 172 | if (class_exists($actionParams['className']) && $actionParams['className']::$groupAction) { |
173 | - echo "<li><a href ='' onclick='inji.Ui.dataManagers.get(this).groupAction(\"" . str_replace('\\', '\\\\', $action) . "\");return false;'>{$actionParams['className']::$name}</a></li>"; |
|
173 | + echo "<li><a href ='' onclick='inji.Ui.dataManagers.get(this).groupAction(\"".str_replace('\\', '\\\\', $action)."\");return false;'>{$actionParams['className']::$name}</a></li>"; |
|
174 | 174 | } |
175 | 175 | } |
176 | 176 | ?> |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | return []; |
222 | 222 | } |
223 | 223 | if (!$this->checkAccess()) { |
224 | - $this->drawError('you not have access to "' . $this->modelName . '" manager with name: "' . $this->managerName . '"'); |
|
224 | + $this->drawError('you not have access to "'.$this->modelName.'" manager with name: "'.$this->managerName.'"'); |
|
225 | 225 | return []; |
226 | 226 | } |
227 | 227 | $modelName = $this->modelName; |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | $queryParams['start'] = $this->page * $this->limit - $this->limit; |
238 | 238 | } |
239 | 239 | if (!empty($params['categoryPath']) && $modelName::$categoryModel) { |
240 | - $queryParams['where'][] = ['tree_path', $params['categoryPath'] . '%', 'LIKE']; |
|
240 | + $queryParams['where'][] = ['tree_path', $params['categoryPath'].'%', 'LIKE']; |
|
241 | 241 | } |
242 | 242 | if (!empty($params['appType'])) { |
243 | 243 | $queryParams['appType'] = $params['appType']; |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | if (!empty($params['filters'][$col]['max'])) { |
297 | 297 | if ($colInfo['colParams']['type'] == 'dateTime' && !strpos($params['filters'][$col]['max'], ' ')) { |
298 | 298 | |
299 | - $date = $params['filters'][$col]['max'] . ' 23:59:59'; |
|
299 | + $date = $params['filters'][$col]['max'].' 23:59:59'; |
|
300 | 300 | } else { |
301 | 301 | $date = $params['filters'][$col]['max']; |
302 | 302 | } |
@@ -323,16 +323,16 @@ discard block |
||
323 | 323 | } |
324 | 324 | switch ($params['filters'][$col]['compareType']) { |
325 | 325 | case 'contains': |
326 | - $queryParams['where'][] = [$col, '%' . $params['filters'][$col]['value'] . '%', 'LIKE']; |
|
326 | + $queryParams['where'][] = [$col, '%'.$params['filters'][$col]['value'].'%', 'LIKE']; |
|
327 | 327 | break; |
328 | 328 | case 'equals': |
329 | 329 | $queryParams['where'][] = [$col, $params['filters'][$col]['value']]; |
330 | 330 | break; |
331 | 331 | case 'starts_with': |
332 | - $queryParams['where'][] = [$col, $params['filters'][$col]['value'] . '%', 'LIKE']; |
|
332 | + $queryParams['where'][] = [$col, $params['filters'][$col]['value'].'%', 'LIKE']; |
|
333 | 333 | break; |
334 | 334 | case 'ends_with': |
335 | - $queryParams['where'][] = [$col, '%' . $params['filters'][$col]['value'], 'LIKE']; |
|
335 | + $queryParams['where'][] = [$col, '%'.$params['filters'][$col]['value'], 'LIKE']; |
|
336 | 336 | break; |
337 | 337 | } |
338 | 338 | break; |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | $item = $relation['relModel']::get([[$item->index(), $item->id], [$model->index(), $model->id]]); |
372 | 372 | } |
373 | 373 | $row = []; |
374 | - $row[] = '<input type ="checkbox" name = "pk[]" value =' . $item->pk() . '>'; |
|
374 | + $row[] = '<input type ="checkbox" name = "pk[]" value ='.$item->pk().'>'; |
|
375 | 375 | $row[] = $item->pk(); |
376 | 376 | foreach ($this->managerOptions['cols'] as $key => $colName) { |
377 | 377 | if (!empty($params['download'])) { |
@@ -417,16 +417,16 @@ discard block |
||
417 | 417 | $managerParams = ['relation' => $modelName::$cols[$colName]['relation']]; |
418 | 418 | $count = $item->{$modelName::$cols[$colName]['relation']}(array_merge($params, ['count' => 1])); |
419 | 419 | $count = $count ? $count : 'Нет'; |
420 | - return "<a class = 'btn btn-xs btn-primary' onclick = 'inji.Ui.dataManagers.popUp(\"" . str_replace('\\', '\\\\', $modelName) . ":" . $item->pk() . "\"," . json_encode(array_merge($params, $managerParams)) . ")'>{$count}</a>"; |
|
420 | + return "<a class = 'btn btn-xs btn-primary' onclick = 'inji.Ui.dataManagers.popUp(\"".str_replace('\\', '\\\\', $modelName).":".$item->pk()."\",".json_encode(array_merge($params, $managerParams)).")'>{$count}</a>"; |
|
421 | 421 | case 'many': |
422 | 422 | $managerParams = ['relation' => $modelName::$cols[$colName]['relation']]; |
423 | 423 | $count = $item->{$modelName::$cols[$colName]['relation']}(array_merge($params, ['count' => 1])); |
424 | 424 | $count = $count ? $count : 'Нет'; |
425 | - return "<a class = 'btn btn-xs btn-primary' onclick = 'inji.Ui.dataManagers.popUp(\"" . str_replace('\\', '\\\\', $modelName) . ":" . $item->pk() . "\"," . json_encode(array_merge($params, $managerParams)) . ")'>{$count}</a>"; |
|
425 | + return "<a class = 'btn btn-xs btn-primary' onclick = 'inji.Ui.dataManagers.popUp(\"".str_replace('\\', '\\\\', $modelName).":".$item->pk()."\",".json_encode(array_merge($params, $managerParams)).")'>{$count}</a>"; |
|
426 | 426 | default : |
427 | 427 | if ($item->{$modelName::$cols[$colName]['relation']}) { |
428 | 428 | if (\App::$cur->name == 'admin') { |
429 | - $href = "<a href ='/admin/" . str_replace('\\', '/view/', $relations[$modelName::$cols[$colName]['relation']]['model']) . "/" . $item->{$modelName::$cols[$colName]['relation']}->pk() . "'>"; |
|
429 | + $href = "<a href ='/admin/".str_replace('\\', '/view/', $relations[$modelName::$cols[$colName]['relation']]['model'])."/".$item->{$modelName::$cols[$colName]['relation']}->pk()."'>"; |
|
430 | 430 | if (!empty($modelName::$cols[$colName]['showCol'])) { |
431 | 431 | $href .= $item->{$modelName::$cols[$colName]['relation']}->{$modelName::$cols[$colName]['showCol']}; |
432 | 432 | } else { |
@@ -456,18 +456,18 @@ discard block |
||
456 | 456 | case 'many': |
457 | 457 | $managerParams = ['relation' => $modelName::$cols[$colName]['relation']]; |
458 | 458 | $count = $item->{$modelName::$cols[$colName]['relation']}(array_merge($params, ['count' => 1])); |
459 | - return "<a class = 'btn btn-xs btn-primary' onclick = 'inji.Ui.dataManagers.popUp(\"" . str_replace('\\', '\\\\', $modelName) . ":" . $item->pk() . "\"," . json_encode(array_merge($params, $managerParams)) . ")'>{$count} " . \Tools::getNumEnding($count, ['Элемент', 'Элемента', 'Элементов']) . "</a>"; |
|
459 | + return "<a class = 'btn btn-xs btn-primary' onclick = 'inji.Ui.dataManagers.popUp(\"".str_replace('\\', '\\\\', $modelName).":".$item->pk()."\",".json_encode(array_merge($params, $managerParams)).")'>{$count} ".\Tools::getNumEnding($count, ['Элемент', 'Элемента', 'Элементов'])."</a>"; |
|
460 | 460 | default: |
461 | 461 | return $item->$colName; |
462 | 462 | } |
463 | 463 | } elseif (!empty($modelName::$cols[$colName]['type'])) { |
464 | - if (\App::$cur->name == 'admin' && $originalCol == 'name' || ( $dataManager && !empty($dataManager->managerOptions['colToView']) && $dataManager->managerOptions['colToView'] == $originalCol)) { |
|
464 | + if (\App::$cur->name == 'admin' && $originalCol == 'name' || ($dataManager && !empty($dataManager->managerOptions['colToView']) && $dataManager->managerOptions['colToView'] == $originalCol)) { |
|
465 | 465 | $formName = $dataManager && !empty($dataManager->managerOptions['editForm']) ? $dataManager->managerOptions['editForm'] : 'manager'; |
466 | - $redirectUrl = !empty($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/admin/' . str_replace('\\', '/', get_class($originalItem)); |
|
467 | - return "<a href ='/admin/" . str_replace('\\', '/view/', get_class($originalItem)) . "/{$originalItem->id}?formName={$formName}&redirectUrl={$redirectUrl}'>{$item->$colName}</a>"; |
|
466 | + $redirectUrl = !empty($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/admin/'.str_replace('\\', '/', get_class($originalItem)); |
|
467 | + return "<a href ='/admin/".str_replace('\\', '/view/', get_class($originalItem))."/{$originalItem->id}?formName={$formName}&redirectUrl={$redirectUrl}'>{$item->$colName}</a>"; |
|
468 | 468 | } elseif (\App::$cur->name == 'admin' && $colName == 'name') { |
469 | - $redirectUrl = !empty($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/admin/' . str_replace('\\', '/', get_class($originalItem)); |
|
470 | - return "<a href ='/admin/" . str_replace('\\', '/view/', get_class($item)) . "/{$item->id}?redirectUrl={$redirectUrl}'>{$item->$colName}</a>"; |
|
469 | + $redirectUrl = !empty($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/admin/'.str_replace('\\', '/', get_class($originalItem)); |
|
470 | + return "<a href ='/admin/".str_replace('\\', '/view/', get_class($item))."/{$item->id}?redirectUrl={$redirectUrl}'>{$item->$colName}</a>"; |
|
471 | 471 | } else { |
472 | 472 | return \Model::resloveTypeValue($item, $colName); |
473 | 473 | } |
@@ -502,7 +502,7 @@ discard block |
||
502 | 502 | return []; |
503 | 503 | } |
504 | 504 | if (!$this->checkAccess()) { |
505 | - $this->drawError('you not have access to "' . $this->modelName . '" manager with name: "' . $this->managerName . '"'); |
|
505 | + $this->drawError('you not have access to "'.$this->modelName.'" manager with name: "'.$this->managerName.'"'); |
|
506 | 506 | return []; |
507 | 507 | } |
508 | 508 | if (!empty($params['limit'])) { |
@@ -516,7 +516,7 @@ discard block |
||
516 | 516 | ]; |
517 | 517 | $modelName = $this->modelName; |
518 | 518 | if (!empty($params['categoryPath']) && $modelName::$categoryModel) { |
519 | - $queryParams['where'][] = ['tree_path', $params['categoryPath'] . '%', 'LIKE']; |
|
519 | + $queryParams['where'][] = ['tree_path', $params['categoryPath'].'%', 'LIKE']; |
|
520 | 520 | } |
521 | 521 | if (!empty($this->managerOptions['userGroupFilter'][\Users\User::$cur->group_id]['getRows'])) { |
522 | 522 | foreach ($this->managerOptions['userGroupFilter'][\Users\User::$cur->group_id]['getRows'] as $colName => $colOptions) { |
@@ -570,7 +570,7 @@ discard block |
||
570 | 570 | if (!empty($params['filters'][$col]['max'])) { |
571 | 571 | if ($colInfo['colParams']['type'] == 'dateTime' && !strpos($params['filters'][$col]['max'], ' ')) { |
572 | 572 | |
573 | - $date = $params['filters'][$col]['max'] . ' 23:59:59'; |
|
573 | + $date = $params['filters'][$col]['max'].' 23:59:59'; |
|
574 | 574 | } else { |
575 | 575 | $date = $params['filters'][$col]['max']; |
576 | 576 | } |
@@ -597,16 +597,16 @@ discard block |
||
597 | 597 | } |
598 | 598 | switch ($params['filters'][$col]['compareType']) { |
599 | 599 | case 'contains': |
600 | - $queryParams['where'][] = [$col, '%' . $params['filters'][$col]['value'] . '%', 'LIKE']; |
|
600 | + $queryParams['where'][] = [$col, '%'.$params['filters'][$col]['value'].'%', 'LIKE']; |
|
601 | 601 | break; |
602 | 602 | case 'equals': |
603 | 603 | $queryParams['where'][] = [$col, $params['filters'][$col]['value']]; |
604 | 604 | break; |
605 | 605 | case 'starts_with': |
606 | - $queryParams['where'][] = [$col, $params['filters'][$col]['value'] . '%', 'LIKE']; |
|
606 | + $queryParams['where'][] = [$col, $params['filters'][$col]['value'].'%', 'LIKE']; |
|
607 | 607 | break; |
608 | 608 | case 'ends_with': |
609 | - $queryParams['where'][] = [$col, '%' . $params['filters'][$col]['value'], 'LIKE']; |
|
609 | + $queryParams['where'][] = [$col, '%'.$params['filters'][$col]['value'], 'LIKE']; |
|
610 | 610 | break; |
611 | 611 | } |
612 | 612 | break; |
@@ -640,7 +640,7 @@ discard block |
||
640 | 640 | $tableCols[] = !empty($colOptions['label']) ? $colOptions['label'] : $colName; |
641 | 641 | } |
642 | 642 | $tableCols[] = ''; |
643 | - $this->table->class .=' datamanagertable'; |
|
643 | + $this->table->class .= ' datamanagertable'; |
|
644 | 644 | $this->table->setCols($tableCols); |
645 | 645 | } |
646 | 646 | |
@@ -663,12 +663,12 @@ discard block |
||
663 | 663 | return false; |
664 | 664 | } |
665 | 665 | if (!$this->checkAccess()) { |
666 | - $this->drawError('you not have access to "' . $this->modelName . '" manager with name: "' . $this->managerName . '"'); |
|
666 | + $this->drawError('you not have access to "'.$this->modelName.'" manager with name: "'.$this->managerName.'"'); |
|
667 | 667 | return []; |
668 | 668 | } |
669 | 669 | $tree = new Tree(); |
670 | 670 | $tree->ul($this->managerOptions['categorys']['model'], 0, function($category) { |
671 | - $path = $category->tree_path . ($category->pk() ? $category->pk() . "/" : ''); |
|
671 | + $path = $category->tree_path.($category->pk() ? $category->pk()."/" : ''); |
|
672 | 672 | $cleanClassName = str_replace('\\', '\\\\', get_class($category)); |
673 | 673 | return "<a href='#' onclick='inji.Ui.dataManagers.get(this).switchCategory(this);return false;' data-index='{$category->index()}' data-path ='{$path}' data-id='{$category->pk()}'> {$category->name}</a> |
674 | 674 |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | $name = ''; |
53 | 53 | foreach ($fields as $field) { |
54 | 54 | if ($field->save && !empty($data[$field->id])) { |
55 | - $name .= htmlspecialchars($data[$field->id]) . ' '; |
|
55 | + $name .= htmlspecialchars($data[$field->id]).' '; |
|
56 | 56 | } |
57 | 57 | } |
58 | 58 | $name = trim($name); |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | $name = ''; |
110 | 110 | foreach ($fields as $field) { |
111 | 111 | if ($field->save && !empty($data[$field->id])) { |
112 | - $name .= htmlspecialchars($data[$field->id]) . ' '; |
|
112 | + $name .= htmlspecialchars($data[$field->id]).' '; |
|
113 | 113 | } |
114 | 114 | } |
115 | 115 | $name = trim($name); |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | foreach ($options['sort'] as $col => $direction) { |
197 | 197 | switch ($col) { |
198 | 198 | case 'price': |
199 | - $selectOptions['order'][] = [Ecommerce\Item\Offer\Price::colPrefix() . 'price', strtolower($direction) == 'desc' ? 'desc' : 'asc']; |
|
199 | + $selectOptions['order'][] = [Ecommerce\Item\Offer\Price::colPrefix().'price', strtolower($direction) == 'desc' ? 'desc' : 'asc']; |
|
200 | 200 | break; |
201 | 201 | case 'name': |
202 | 202 | $selectOptions['order'][] = ['name', strtolower($direction) == 'desc' ? 'desc' : 'asc']; |
@@ -215,22 +215,22 @@ discard block |
||
215 | 215 | $selectOptions['where'][] = ['image_file_id', 0, '!=']; |
216 | 216 | } |
217 | 217 | |
218 | - $selectOptions['join'][] = [Ecommerce\Item\Offer::table(), Ecommerce\Item::index() . ' = ' . Ecommerce\Item\Offer::colPrefix() . Ecommerce\Item::index(), 'inner']; |
|
218 | + $selectOptions['join'][] = [Ecommerce\Item\Offer::table(), Ecommerce\Item::index().' = '.Ecommerce\Item\Offer::colPrefix().Ecommerce\Item::index(), 'inner']; |
|
219 | 219 | |
220 | 220 | $selectOptions['join'][] = [Ecommerce\Item\Offer\Price::table(), |
221 | - Ecommerce\Item\Offer::index() . ' = ' . Ecommerce\Item\Offer\Price::colPrefix() . Ecommerce\Item\Offer::index() . |
|
222 | - (empty($this->config['show_zero_price']) ? ' and ' . Ecommerce\Item\Offer\Price::colPrefix() . 'price>0' : ''), |
|
221 | + Ecommerce\Item\Offer::index().' = '.Ecommerce\Item\Offer\Price::colPrefix().Ecommerce\Item\Offer::index(). |
|
222 | + (empty($this->config['show_zero_price']) ? ' and '.Ecommerce\Item\Offer\Price::colPrefix().'price>0' : ''), |
|
223 | 223 | empty($this->config['show_without_price']) ? 'inner' : 'left']; |
224 | 224 | |
225 | 225 | $selectOptions['join'][] = [ |
226 | - Ecommerce\Item\Offer\Price\Type::table(), Ecommerce\Item\Offer\Price::colPrefix() . Ecommerce\Item\Offer\Price\Type::index() . ' = ' . Ecommerce\Item\Offer\Price\Type::index() |
|
226 | + Ecommerce\Item\Offer\Price\Type::table(), Ecommerce\Item\Offer\Price::colPrefix().Ecommerce\Item\Offer\Price\Type::index().' = '.Ecommerce\Item\Offer\Price\Type::index() |
|
227 | 227 | ]; |
228 | 228 | |
229 | 229 | $selectOptions['where'][] = [ |
230 | 230 | [Ecommerce\Item\Offer\Price\Type::index(), NULL, 'is'], |
231 | 231 | [ |
232 | - [Ecommerce\Item\Offer\Price\Type::colPrefix() . 'roles', '', '=', 'OR'], |
|
233 | - [Ecommerce\Item\Offer\Price\Type::colPrefix() . 'roles', '%|' . \Users\User::$cur->role_id . '|%', 'LIKE', 'OR'], |
|
232 | + [Ecommerce\Item\Offer\Price\Type::colPrefix().'roles', '', '=', 'OR'], |
|
233 | + [Ecommerce\Item\Offer\Price\Type::colPrefix().'roles', '%|'.\Users\User::$cur->role_id.'|%', 'LIKE', 'OR'], |
|
234 | 234 | ], |
235 | 235 | ]; |
236 | 236 | |
@@ -238,10 +238,10 @@ discard block |
||
238 | 238 | if (!empty($this->config['view_filter'])) { |
239 | 239 | if (!empty($this->config['view_filter']['options'])) { |
240 | 240 | foreach ($this->config['view_filter']['options'] as $optionId => $optionValue) { |
241 | - $selectOptions['join'][] = [Ecommerce\Item\Param::table(), Ecommerce\Item::index() . ' = ' . 'option' . $optionId . '.' . Ecommerce\Item\Param::colPrefix() . Ecommerce\Item::index() . ' AND ' . |
|
242 | - 'option' . $optionId . '.' . Ecommerce\Item\Param::colPrefix() . Ecommerce\Item\Option::index() . ' = "' . (int) $optionId . '" AND ' . |
|
243 | - 'option' . $optionId . '.' . Ecommerce\Item\Param::colPrefix() . 'value = "' . (int) $optionValue . '"', |
|
244 | - 'inner', 'option' . $optionId]; |
|
241 | + $selectOptions['join'][] = [Ecommerce\Item\Param::table(), Ecommerce\Item::index().' = '.'option'.$optionId.'.'.Ecommerce\Item\Param::colPrefix().Ecommerce\Item::index().' AND '. |
|
242 | + 'option'.$optionId.'.'.Ecommerce\Item\Param::colPrefix().Ecommerce\Item\Option::index().' = "'.(int) $optionId.'" AND '. |
|
243 | + 'option'.$optionId.'.'.Ecommerce\Item\Param::colPrefix().'value = "'.(int) $optionValue.'"', |
|
244 | + 'inner', 'option'.$optionId]; |
|
245 | 245 | } |
246 | 246 | } |
247 | 247 | } |
@@ -251,29 +251,29 @@ discard block |
||
251 | 251 | switch ($col) { |
252 | 252 | case 'price': |
253 | 253 | if (!empty($filter['min'])) { |
254 | - $selectOptions['where'][] = [Ecommerce\Item\Offer\Price::colPrefix() . 'price', (float) $filter['min'], '>=']; |
|
254 | + $selectOptions['where'][] = [Ecommerce\Item\Offer\Price::colPrefix().'price', (float) $filter['min'], '>=']; |
|
255 | 255 | } |
256 | 256 | if (!empty($filter['max'])) { |
257 | - $selectOptions['where'][] = [Ecommerce\Item\Offer\Price::colPrefix() . 'price', (float) $filter['max'], '<=']; |
|
257 | + $selectOptions['where'][] = [Ecommerce\Item\Offer\Price::colPrefix().'price', (float) $filter['max'], '<=']; |
|
258 | 258 | } |
259 | 259 | break; |
260 | 260 | case 'options': |
261 | 261 | foreach ($filter as $optionId => $optionValue) { |
262 | 262 | $optionId = (int) $optionId; |
263 | - $selectOptions['join'][] = [Ecommerce\Item\Param::table(), Ecommerce\Item::index() . ' = ' . 'option' . $optionId . '.' . Ecommerce\Item\Param::colPrefix() . Ecommerce\Item::index() . ' AND ' . |
|
264 | - 'option' . $optionId . '.' . Ecommerce\Item\Param::colPrefix() . Ecommerce\Item\Option::index() . ' = "' . (int) $optionId . '" AND ' . |
|
265 | - 'option' . $optionId . '.' . Ecommerce\Item\Param::colPrefix() . 'value = ' . \App::$cur->db->connection->pdo->quote($optionValue) . '', |
|
266 | - 'inner', 'option' . $optionId]; |
|
263 | + $selectOptions['join'][] = [Ecommerce\Item\Param::table(), Ecommerce\Item::index().' = '.'option'.$optionId.'.'.Ecommerce\Item\Param::colPrefix().Ecommerce\Item::index().' AND '. |
|
264 | + 'option'.$optionId.'.'.Ecommerce\Item\Param::colPrefix().Ecommerce\Item\Option::index().' = "'.(int) $optionId.'" AND '. |
|
265 | + 'option'.$optionId.'.'.Ecommerce\Item\Param::colPrefix().'value = '.\App::$cur->db->connection->pdo->quote($optionValue).'', |
|
266 | + 'inner', 'option'.$optionId]; |
|
267 | 267 | } |
268 | 268 | break; |
269 | 269 | case 'offerOptions': |
270 | 270 | //$selectOptions['join'][] = [Ecommerce\Item\Offer::table(), Ecommerce\Item::index() . ' = offer.' . Ecommerce\Item\Offer::colPrefix() . Ecommerce\Item::index(), 'left', 'offer']; |
271 | 271 | foreach ($filter as $optionId => $optionValue) { |
272 | 272 | $optionId = (int) $optionId; |
273 | - $selectOptions['join'][] = [Ecommerce\Item\Offer\Param::table(), Ecommerce\Item\Offer::index() . ' = ' . 'offerOption' . $optionId . '.' . Ecommerce\Item\Offer\Param::colPrefix() . Ecommerce\Item\Offer::index() . ' AND ' . |
|
274 | - 'offerOption' . $optionId . '.' . Ecommerce\Item\Offer\Param::colPrefix() . Ecommerce\Item\Offer\Option::index() . ' = "' . (int) $optionId . '" AND ' . |
|
275 | - 'offerOption' . $optionId . '.' . Ecommerce\Item\Offer\Param::colPrefix() . 'value = ' . \App::$cur->db->connection->pdo->quote($optionValue) . '', |
|
276 | - 'inner', 'offerOption' . $optionId]; |
|
273 | + $selectOptions['join'][] = [Ecommerce\Item\Offer\Param::table(), Ecommerce\Item\Offer::index().' = '.'offerOption'.$optionId.'.'.Ecommerce\Item\Offer\Param::colPrefix().Ecommerce\Item\Offer::index().' AND '. |
|
274 | + 'offerOption'.$optionId.'.'.Ecommerce\Item\Offer\Param::colPrefix().Ecommerce\Item\Offer\Option::index().' = "'.(int) $optionId.'" AND '. |
|
275 | + 'offerOption'.$optionId.'.'.Ecommerce\Item\Offer\Param::colPrefix().'value = '.\App::$cur->db->connection->pdo->quote($optionValue).'', |
|
276 | + 'inner', 'offerOption'.$optionId]; |
|
277 | 277 | } |
278 | 278 | break; |
279 | 279 | } |
@@ -288,13 +288,13 @@ discard block |
||
288 | 288 | continue; |
289 | 289 | } |
290 | 290 | $category = \Ecommerce\Category::get($categoryId); |
291 | - $where[] = ['tree_path', $category->tree_path . (int) $categoryId . '/%', 'LIKE', $first ? 'AND' : 'OR']; |
|
291 | + $where[] = ['tree_path', $category->tree_path.(int) $categoryId.'/%', 'LIKE', $first ? 'AND' : 'OR']; |
|
292 | 292 | $first = false; |
293 | 293 | } |
294 | 294 | $selectOptions['where'][] = $where; |
295 | 295 | } elseif (!empty($options['parent'])) { |
296 | 296 | $category = \Ecommerce\Category::get($options['parent']); |
297 | - $selectOptions['where'][] = ['tree_path', $category->tree_path . (int) $options['parent'] . '/%', 'LIKE']; |
|
297 | + $selectOptions['where'][] = ['tree_path', $category->tree_path.(int) $options['parent'].'/%', 'LIKE']; |
|
298 | 298 | } |
299 | 299 | |
300 | 300 | //search |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | foreach (explode(' ', $searchStr) as $part) { |
305 | 305 | $part = trim($part); |
306 | 306 | if ($part && strlen($part) > 2) { |
307 | - $searchArr[] = ['search_index', '%' . $part . '%', 'LIKE']; |
|
307 | + $searchArr[] = ['search_index', '%'.$part.'%', 'LIKE']; |
|
308 | 308 | } |
309 | 309 | } |
310 | 310 | if (!empty($searchArr)) { |
@@ -323,19 +323,19 @@ discard block |
||
323 | 323 | } |
324 | 324 | $selectOptions['where'][] = [ |
325 | 325 | '( |
326 | - (SELECT COALESCE(sum(`' . \Ecommerce\Item\Offer\Warehouse::colPrefix() . 'count`),0) |
|
327 | - FROM ' . \App::$cur->db->table_prefix . \Ecommerce\Item\Offer\Warehouse::table() . ' iciw |
|
328 | - WHERE iciw.' . \Ecommerce\Item\Offer\Warehouse::colPrefix() . \Ecommerce\Item\Offer::index() . ' = ' . \Ecommerce\Item\Offer::index() . ' |
|
329 | - ' . ($warehouseIds ? ' AND iciw.' . \Ecommerce\Item\Offer\Warehouse::colPrefix() . \Ecommerce\Warehouse::index() . ' IN(' . implode(',', $warehouseIds) . ')' : '') . ' |
|
326 | + (SELECT COALESCE(sum(`' . \Ecommerce\Item\Offer\Warehouse::colPrefix().'count`),0) |
|
327 | + FROM ' . \App::$cur->db->table_prefix.\Ecommerce\Item\Offer\Warehouse::table().' iciw |
|
328 | + WHERE iciw.' . \Ecommerce\Item\Offer\Warehouse::colPrefix().\Ecommerce\Item\Offer::index().' = '.\Ecommerce\Item\Offer::index().' |
|
329 | + ' . ($warehouseIds ? ' AND iciw.'.\Ecommerce\Item\Offer\Warehouse::colPrefix().\Ecommerce\Warehouse::index().' IN('.implode(',', $warehouseIds).')' : '').' |
|
330 | 330 | ) |
331 | 331 | - |
332 | - (SELECT COALESCE(sum(' . \Ecommerce\Warehouse\Block::colPrefix() . 'count) ,0) |
|
333 | - FROM ' . \App::$cur->db->table_prefix . \Ecommerce\Warehouse\Block::table() . ' iewb |
|
334 | - inner JOIN ' . \App::$cur->db->table_prefix . \Ecommerce\Cart::table() . ' icc ON icc.' . \Ecommerce\Cart::index() . ' = iewb.' . \Ecommerce\Warehouse\Block::colPrefix() . \Ecommerce\Cart::index() . ' AND ( |
|
335 | - (`' . \Ecommerce\Cart::colPrefix() . 'warehouse_block` = 1 and `' . \Ecommerce\Cart::colPrefix() . 'cart_status_id` in(2,3,6)) || |
|
336 | - (`' . \Ecommerce\Cart::colPrefix() . \Ecommerce\Cart\Status::index() . '` in(0,1) and `' . \Ecommerce\Cart::colPrefix() . 'date_last_activ` >=subdate(now(),INTERVAL 30 MINUTE)) |
|
332 | + (SELECT COALESCE(sum(' . \Ecommerce\Warehouse\Block::colPrefix().'count) ,0) |
|
333 | + FROM ' . \App::$cur->db->table_prefix.\Ecommerce\Warehouse\Block::table().' iewb |
|
334 | + inner JOIN ' . \App::$cur->db->table_prefix.\Ecommerce\Cart::table().' icc ON icc.'.\Ecommerce\Cart::index().' = iewb.'.\Ecommerce\Warehouse\Block::colPrefix().\Ecommerce\Cart::index().' AND ( |
|
335 | + (`' . \Ecommerce\Cart::colPrefix().'warehouse_block` = 1 and `'.\Ecommerce\Cart::colPrefix().'cart_status_id` in(2,3,6)) || |
|
336 | + (`' . \Ecommerce\Cart::colPrefix().\Ecommerce\Cart\Status::index().'` in(0,1) and `'.\Ecommerce\Cart::colPrefix().'date_last_activ` >=subdate(now(),INTERVAL 30 MINUTE)) |
|
337 | 337 | ) |
338 | - WHERE iewb.' . \Ecommerce\Warehouse\Block::colPrefix() . \Ecommerce\Item\Offer::index() . ' = ' . \Ecommerce\Item\Offer::index() . ') |
|
338 | + WHERE iewb.' . \Ecommerce\Warehouse\Block::colPrefix().\Ecommerce\Item\Offer::index().' = '.\Ecommerce\Item\Offer::index().') |
|
339 | 339 | )', |
340 | 340 | 0, |
341 | 341 | '>' |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | $items = Ecommerce\Item::getList($selectOptions); |
365 | 365 | $items = Ecommerce\Item\Param::getList([ |
366 | 366 | 'where' => ['item_id', array_keys($items), 'IN'], |
367 | - 'join' => [[Ecommerce\Item\Option::table(), Ecommerce\Item\Option::index() . ' = ' . \Ecommerce\Item\Param::colPrefix() . Ecommerce\Item\Option::index() . ' and ' . \Ecommerce\Item\Option::colPrefix() . 'searchable = 1', 'inner']], |
|
367 | + 'join' => [[Ecommerce\Item\Option::table(), Ecommerce\Item\Option::index().' = '.\Ecommerce\Item\Param::colPrefix().Ecommerce\Item\Option::index().' and '.\Ecommerce\Item\Option::colPrefix().'searchable = 1', 'inner']], |
|
368 | 368 | 'distinct' => \Ecommerce\Item\Option::index() |
369 | 369 | ]); |
370 | 370 | return $items; |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | if (is_array($counts)) { |
398 | 398 | $sum = 0; |
399 | 399 | foreach ($counts as $count) { |
400 | - $sum +=$count['count']; |
|
400 | + $sum += $count['count']; |
|
401 | 401 | } |
402 | 402 | return $sum; |
403 | 403 | } |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | |
434 | 434 | if (!empty($conf['files']['aditionTemplateFiels'])) { |
435 | 435 | foreach ($conf['files']['aditionTemplateFiels'] as $file) { |
436 | - $return[$file['file']] = '- ' . $file['name']; |
|
436 | + $return[$file['file']] = '- '.$file['name']; |
|
437 | 437 | } |
438 | 438 | } |
439 | 439 | return $return; |
@@ -55,7 +55,7 @@ |
||
55 | 55 | |
56 | 56 | public function realType() |
57 | 57 | { |
58 | - if ($this->option && $this->option->type) { |
|
58 | + if ($this->option && $this->option->type) { |
|
59 | 59 | $type = $this->option->type; |
60 | 60 | |
61 | 61 | if ($type == 'select') { |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | 'col' => 'item_offer_id', |
77 | 77 | //'resultKey' => 'code', |
78 | 78 | 'resultKey' => 'item_offer_option_id', |
79 | - 'join' => [Offer\Option::table(), Offer\Option::index() . ' = ' . Offer\Param::colPrefix() . Offer\Option::index()] |
|
79 | + 'join' => [Offer\Option::table(), Offer\Option::index().' = '.Offer\Param::colPrefix().Offer\Option::index()] |
|
80 | 80 | ], |
81 | 81 | 'item' => [ |
82 | 82 | 'model' => 'Ecommerce\Item', |
@@ -89,12 +89,12 @@ discard block |
||
89 | 89 | { |
90 | 90 | $warehouse = Offer\Warehouse::get([['count', '0', '>'], ['item_offer_id', $this->id]]); |
91 | 91 | if ($warehouse) { |
92 | - $warehouse->count +=(float) $count; |
|
92 | + $warehouse->count += (float) $count; |
|
93 | 93 | $warehouse->save(); |
94 | 94 | } else { |
95 | 95 | $warehouse = Offer\Warehouse::get([['item_offer_id', $this->id]]); |
96 | 96 | if ($warehouse) { |
97 | - $warehouse->count +=(float) $count; |
|
97 | + $warehouse->count += (float) $count; |
|
98 | 98 | $warehouse->save(); |
99 | 99 | } |
100 | 100 | } |
@@ -112,21 +112,21 @@ discard block |
||
112 | 112 | } |
113 | 113 | } |
114 | 114 | if ($warehouseIds) { |
115 | - \App::$cur->db->where(\Ecommerce\Item\Offer\Warehouse::colPrefix() . \Ecommerce\Warehouse::index(), $warehouseIds, 'IN'); |
|
115 | + \App::$cur->db->where(\Ecommerce\Item\Offer\Warehouse::colPrefix().\Ecommerce\Warehouse::index(), $warehouseIds, 'IN'); |
|
116 | 116 | } |
117 | - \App::$cur->db->where(\Ecommerce\Item\Offer\Warehouse::colPrefix() . \Ecommerce\Item\Offer::index(), $this->id); |
|
118 | - \App::$cur->db->cols = 'COALESCE(sum(' . \Ecommerce\Item\Offer\Warehouse::colPrefix() . 'count),0) as `sum` '; |
|
117 | + \App::$cur->db->where(\Ecommerce\Item\Offer\Warehouse::colPrefix().\Ecommerce\Item\Offer::index(), $this->id); |
|
118 | + \App::$cur->db->cols = 'COALESCE(sum('.\Ecommerce\Item\Offer\Warehouse::colPrefix().'count),0) as `sum` '; |
|
119 | 119 | $warehouse = \App::$cur->db->select(\Ecommerce\Item\Offer\Warehouse::table())->fetch(); |
120 | 120 | |
121 | - \App::$cur->db->cols = 'COALESCE(sum(' . \Ecommerce\Warehouse\Block::colPrefix() . 'count) ,0) as `sum` '; |
|
122 | - \App::$cur->db->where(\Ecommerce\Warehouse\Block::colPrefix() . \Ecommerce\Item\Offer::index(), $this->id); |
|
121 | + \App::$cur->db->cols = 'COALESCE(sum('.\Ecommerce\Warehouse\Block::colPrefix().'count) ,0) as `sum` '; |
|
122 | + \App::$cur->db->where(\Ecommerce\Warehouse\Block::colPrefix().\Ecommerce\Item\Offer::index(), $this->id); |
|
123 | 123 | if ($cart_id) { |
124 | - \App::$cur->db->where(\Ecommerce\Warehouse\Block::colPrefix() . \Ecommerce\Cart::index(), (int) $cart_id, '!='); |
|
124 | + \App::$cur->db->where(\Ecommerce\Warehouse\Block::colPrefix().\Ecommerce\Cart::index(), (int) $cart_id, '!='); |
|
125 | 125 | } |
126 | 126 | $on = ' |
127 | - ' . \Ecommerce\Cart::index() . ' = ' . \Ecommerce\Warehouse\Block::colPrefix() . \Ecommerce\Cart::index() . ' AND ( |
|
128 | - (`' . \Ecommerce\Cart::colPrefix() . 'warehouse_block` = 1 and `' . \Ecommerce\Cart::colPrefix() . 'cart_status_id` in(2,3,6)) || |
|
129 | - (`' . \Ecommerce\Cart::colPrefix() . 'cart_status_id` in(0,1) and `' . \Ecommerce\Cart::colPrefix() . 'date_last_activ` >=subdate(now(),INTERVAL 30 MINUTE)) |
|
127 | + ' . \Ecommerce\Cart::index().' = '.\Ecommerce\Warehouse\Block::colPrefix().\Ecommerce\Cart::index().' AND ( |
|
128 | + (`' . \Ecommerce\Cart::colPrefix().'warehouse_block` = 1 and `'.\Ecommerce\Cart::colPrefix().'cart_status_id` in(2,3,6)) || |
|
129 | + (`' . \Ecommerce\Cart::colPrefix().'cart_status_id` in(0,1) and `'.\Ecommerce\Cart::colPrefix().'date_last_activ` >=subdate(now(),INTERVAL 30 MINUTE)) |
|
130 | 130 | ) |
131 | 131 | '; |
132 | 132 | \App::$cur->db->join(\Ecommerce\Cart::table(), $on, 'inner'); |