@@ -10,15 +10,15 @@ |
||
10 | 10 | 'href' => "/admin/modules/createControllerMethod/{$module}/{$type}/{$controller}", |
11 | 11 | 'text' => 'Создать' |
12 | 12 | ]); |
13 | -$class = CodeGenerator::parseClass(Modules::getModulePath($module) . '/' . $type . '/' . $controller . '.php'); |
|
13 | +$class = CodeGenerator::parseClass(Modules::getModulePath($module).'/'.$type.'/'.$controller.'.php'); |
|
14 | 14 | foreach ($class->methods as $method) { |
15 | 15 | $name = str_replace('Action', '', $method->name); |
16 | 16 | $table->addRow([ |
17 | 17 | $name, |
18 | 18 | [ |
19 | 19 | 'class' => 'actionTd', |
20 | - 'html' => '<a class="btn btn-xs btn-success" href="/admin/modules/editControllerMethod/' . $module . '/' . $type . '/' . $controller . '/' . $name . '"><i class="glyphicon glyphicon-edit"></i></a>' |
|
21 | - . ' <a class="btn btn-xs btn-danger" href="/admin/modules/delControllerMethod/' . $module . '/' . $type . '/' . $controller . '/' . $name . '"><i class="glyphicon glyphicon-remove"></i></a>' |
|
20 | + 'html' => '<a class="btn btn-xs btn-success" href="/admin/modules/editControllerMethod/'.$module.'/'.$type.'/'.$controller.'/'.$name.'"><i class="glyphicon glyphicon-edit"></i></a>' |
|
21 | + . ' <a class="btn btn-xs btn-danger" href="/admin/modules/delControllerMethod/'.$module.'/'.$type.'/'.$controller.'/'.$name.'"><i class="glyphicon glyphicon-remove"></i></a>' |
|
22 | 22 | ] |
23 | 23 | ]); |
24 | 24 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | $config = App::$primary->config; |
22 | 22 | $config['defaultModule'] = $module; |
23 | 23 | Config::save('app', $config); |
24 | - Tools::redirect('/admin/modules', 'Модулем по умолчанию установлен: ' . $module, 'success'); |
|
24 | + Tools::redirect('/admin/modules', 'Модулем по умолчанию установлен: '.$module, 'success'); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | public function installAction() |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | foreach ($_GET['modules'] as $module) { |
31 | 31 | $this->modules->install($module); |
32 | 32 | } |
33 | - Tools::redirect('/admin/modules', 'Моудли ' . implode(',', $_GET['modules']) . ' установлены'); |
|
33 | + Tools::redirect('/admin/modules', 'Моудли '.implode(',', $_GET['modules']).' установлены'); |
|
34 | 34 | } |
35 | 35 | $this->view->page(); |
36 | 36 | } |
@@ -40,14 +40,14 @@ discard block |
||
40 | 40 | $codeName = filter_input(INPUT_POST, 'codeName'); |
41 | 41 | if ($codeName && filter_input(INPUT_POST, 'name')) { |
42 | 42 | $codeName = ucfirst($codeName); |
43 | - if (file_exists(App::$primary->path . '/modules/' . $codeName . '.php')) { |
|
43 | + if (file_exists(App::$primary->path.'/modules/'.$codeName.'.php')) { |
|
44 | 44 | Msg::add('Модуль с таким именем уже существует'); |
45 | 45 | } else { |
46 | 46 | $this->modules->createBlankModule(filter_input(INPUT_POST, 'name'), $codeName); |
47 | 47 | $config = App::$primary->config; |
48 | 48 | $config['modules'][] = $codeName; |
49 | 49 | Config::save('app', $config); |
50 | - Tools::redirect('/admin/modules', 'Моудль ' . $codeName . ' создан и установлен'); |
|
50 | + Tools::redirect('/admin/modules', 'Моудль '.$codeName.' создан и установлен'); |
|
51 | 51 | } |
52 | 52 | } |
53 | 53 | $this->view->page(); |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | |
56 | 56 | public function editorAction($module) |
57 | 57 | { |
58 | - if (!file_exists(Module::getModulePath($module) . '/generatorHash.php')) { |
|
58 | + if (!file_exists(Module::getModulePath($module).'/generatorHash.php')) { |
|
59 | 59 | Msg::add('Этот модуль был создан без помощи генератора. Возможности его изменения ограничены и могут привести к порче модуля', 'danger'); |
60 | 60 | } |
61 | 61 | $this->view->page(['data' => compact('module')]); |
@@ -63,18 +63,18 @@ discard block |
||
63 | 63 | |
64 | 64 | public function editModelAction($module, $modelName) |
65 | 65 | { |
66 | - $path = Modules::getModulePath($module) . '/models/' . $modelName . '.php'; |
|
66 | + $path = Modules::getModulePath($module).'/models/'.$modelName.'.php'; |
|
67 | 67 | if (!file_exists($path)) { |
68 | - Tools::redirect('/admin/modules/edit/' . $module, 'Модель ' . $modelName . ' не найдена', 'danger'); |
|
68 | + Tools::redirect('/admin/modules/edit/'.$module, 'Модель '.$modelName.' не найдена', 'danger'); |
|
69 | 69 | } |
70 | - include_once Modules::getModulePath($module) . '/models/' . $modelName . '.php'; |
|
71 | - $modelFullName = $module . '\\' . $modelName; |
|
70 | + include_once Modules::getModulePath($module).'/models/'.$modelName.'.php'; |
|
71 | + $modelFullName = $module.'\\'.$modelName; |
|
72 | 72 | $model = new $modelFullName; |
73 | 73 | if (filter_input(INPUT_POST, 'codeName') && filter_input(INPUT_POST, 'name')) { |
74 | 74 | $this->modules->generateModel($module, filter_input(INPUT_POST, 'name'), filter_input(INPUT_POST, 'codeName'), [ |
75 | 75 | 'cols' => $_POST['cols'] |
76 | 76 | ]); |
77 | - Tools::redirect('/admin/modules/editor/' . $module, 'Модель ' . filter_input(INPUT_POST, 'codeName') . ' была сохранена'); |
|
77 | + Tools::redirect('/admin/modules/editor/'.$module, 'Модель '.filter_input(INPUT_POST, 'codeName').' была сохранена'); |
|
78 | 78 | } |
79 | 79 | $this->view->page(['content' => 'modelEditor', 'data' => compact('module', 'modelName', 'modelFullName', 'model')]); |
80 | 80 | } |
@@ -85,20 +85,20 @@ discard block |
||
85 | 85 | $this->modules->generateModel($module, filter_input(INPUT_POST, 'name'), filter_input(INPUT_POST, 'codeName'), [ |
86 | 86 | 'cols' => $_POST['cols'] |
87 | 87 | ]); |
88 | - Tools::redirect('/admin/modules/editor/' . $module, 'Модель ' . filter_input(INPUT_POST, 'codeName') . ' была создана'); |
|
88 | + Tools::redirect('/admin/modules/editor/'.$module, 'Модель '.filter_input(INPUT_POST, 'codeName').' была создана'); |
|
89 | 89 | } |
90 | 90 | $this->view->page(['content' => 'modelEditor', 'data' => compact('module')]); |
91 | 91 | } |
92 | 92 | |
93 | 93 | public function delModelAction($module, $modelName) |
94 | 94 | { |
95 | - unlink(App::$primary->path . '/modules/' . $module . '/models/' . $modelName . '.php'); |
|
96 | - $config = Config::custom(App::$primary->path . '/modules/' . $module . '/generatorHash.php'); |
|
97 | - if (isset($config['models/' . $modelName . '.php'])) { |
|
98 | - unset($config['models/' . $modelName . '.php']); |
|
99 | - Config::save(App::$primary->path . '/modules/' . $module . '/generatorHash.php', $config); |
|
95 | + unlink(App::$primary->path.'/modules/'.$module.'/models/'.$modelName.'.php'); |
|
96 | + $config = Config::custom(App::$primary->path.'/modules/'.$module.'/generatorHash.php'); |
|
97 | + if (isset($config['models/'.$modelName.'.php'])) { |
|
98 | + unset($config['models/'.$modelName.'.php']); |
|
99 | + Config::save(App::$primary->path.'/modules/'.$module.'/generatorHash.php', $config); |
|
100 | 100 | } |
101 | - Tools::redirect('/admin/modules/editor/' . $module, 'Модель ' . $modelName . ' была удалена'); |
|
101 | + Tools::redirect('/admin/modules/editor/'.$module, 'Модель '.$modelName.' была удалена'); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | public function createControllerAction($module) |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | $controllerType = filter_input(INPUT_POST, 'type'); |
107 | 107 | if ($controllerType) { |
108 | 108 | $this->modules->createController($module, $controllerType); |
109 | - Tools::redirect('/admin/modules/editor/' . $module, 'Контроллер был создан'); |
|
109 | + Tools::redirect('/admin/modules/editor/'.$module, 'Контроллер был создан'); |
|
110 | 110 | } |
111 | 111 | $this->view->page(); |
112 | 112 | } |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | $url = filter_input(INPUT_POST, 'url'); |
122 | 122 | if ($url) { |
123 | 123 | $this->modules->addActionToController($module, $type, $controller, $url); |
124 | - Tools::redirect('/admin/modules/editor/' . $module, 'Контроллер был изменен'); |
|
124 | + Tools::redirect('/admin/modules/editor/'.$module, 'Контроллер был изменен'); |
|
125 | 125 | } |
126 | 126 | $this->view->page(['data' => compact('module', 'type', 'controller')]); |
127 | 127 | } |
@@ -13,19 +13,19 @@ discard block |
||
13 | 13 | public function createBlankModule($name, $codeName) |
14 | 14 | { |
15 | 15 | $codeName = ucfirst($codeName); |
16 | - Tools::createDir(App::$primary->path . '/modules/' . $codeName); |
|
16 | + Tools::createDir(App::$primary->path.'/modules/'.$codeName); |
|
17 | 17 | ob_start(); |
18 | - include $this->path . '/tpls/BlankModule.php'; |
|
18 | + include $this->path.'/tpls/BlankModule.php'; |
|
19 | 19 | $moduleCode = ob_get_contents(); |
20 | 20 | ob_end_clean(); |
21 | - file_put_contents(App::$primary->path . '/modules/' . $codeName . '/' . $codeName . '.php', $moduleCode); |
|
22 | - file_put_contents(App::$primary->path . '/modules/' . $codeName . '/info.php', "<?php\nreturn " . CodeGenerator::genArray(['name' => $name])); |
|
23 | - file_put_contents(App::$primary->path . '/modules/' . $codeName . '/generatorHash.php', "<?php\nreturn " . CodeGenerator::genArray([$codeName . '.php' => md5($moduleCode)])); |
|
21 | + file_put_contents(App::$primary->path.'/modules/'.$codeName.'/'.$codeName.'.php', $moduleCode); |
|
22 | + file_put_contents(App::$primary->path.'/modules/'.$codeName.'/info.php', "<?php\nreturn ".CodeGenerator::genArray(['name' => $name])); |
|
23 | + file_put_contents(App::$primary->path.'/modules/'.$codeName.'/generatorHash.php', "<?php\nreturn ".CodeGenerator::genArray([$codeName.'.php' => md5($moduleCode)])); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | public function parseColsForModel($cols = []) |
27 | 27 | { |
28 | - $modelCols = [ 'labels' => [], 'cols' => [], 'relations' => []]; |
|
28 | + $modelCols = ['labels' => [], 'cols' => [], 'relations' => []]; |
|
29 | 29 | foreach ($cols as $col) { |
30 | 30 | $modelCols['labels'][$col['code']] = $col['label']; |
31 | 31 | $colType = !empty($col['type']['primary']) ? $col['type']['primary'] : $col['type']; |
@@ -50,11 +50,11 @@ discard block |
||
50 | 50 | |
51 | 51 | $colsExist = App::$cur->db->getTableCols($tableName); |
52 | 52 | $tableCols = []; |
53 | - if (empty($colsExist[$colPrefix . 'id'])) { |
|
54 | - $tableCols[$colPrefix . 'id'] = 'pk'; |
|
53 | + if (empty($colsExist[$colPrefix.'id'])) { |
|
54 | + $tableCols[$colPrefix.'id'] = 'pk'; |
|
55 | 55 | } |
56 | 56 | foreach ($cols as $col) { |
57 | - if (!empty($colsExist[$colPrefix . $col['code']])) { |
|
57 | + if (!empty($colsExist[$colPrefix.$col['code']])) { |
|
58 | 58 | continue; |
59 | 59 | } |
60 | 60 | $colType = !empty($col['type']['primary']) ? $col['type']['primary'] : $col['type']; |
@@ -62,23 +62,23 @@ discard block |
||
62 | 62 | case 'image': |
63 | 63 | case 'number': |
64 | 64 | case 'relation': |
65 | - $tableCols[$colPrefix . $col['code']] = 'int(11) NOT NULL'; |
|
65 | + $tableCols[$colPrefix.$col['code']] = 'int(11) NOT NULL'; |
|
66 | 66 | break; |
67 | 67 | case 'decimal': |
68 | - $tableCols[$colPrefix . $col['code']] = 'decimal(11,2) NOT NULL'; |
|
68 | + $tableCols[$colPrefix.$col['code']] = 'decimal(11,2) NOT NULL'; |
|
69 | 69 | break; |
70 | 70 | case 'dateTime': |
71 | - $tableCols[$colPrefix . $col['code']] = 'timestamp NOT NULL'; |
|
71 | + $tableCols[$colPrefix.$col['code']] = 'timestamp NOT NULL'; |
|
72 | 72 | break; |
73 | 73 | case 'currentDateTime': |
74 | - $tableCols[$colPrefix . $col['code']] = 'timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP'; |
|
74 | + $tableCols[$colPrefix.$col['code']] = 'timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP'; |
|
75 | 75 | break; |
76 | 76 | case 'text': |
77 | - $tableCols[$colPrefix . $col['code']] = 'varchar(255) NOT NULL'; |
|
77 | + $tableCols[$colPrefix.$col['code']] = 'varchar(255) NOT NULL'; |
|
78 | 78 | break; |
79 | 79 | case 'textarea': |
80 | 80 | default: |
81 | - $tableCols[$colPrefix . $col['code']] = 'text NOT NULL'; |
|
81 | + $tableCols[$colPrefix.$col['code']] = 'text NOT NULL'; |
|
82 | 82 | break; |
83 | 83 | } |
84 | 84 | } |
@@ -94,8 +94,8 @@ discard block |
||
94 | 94 | $modelCols = $this->parseColsForModel(); |
95 | 95 | if (!empty($options['cols'])) { |
96 | 96 | $modelCols = $this->parseColsForModel($options['cols']); |
97 | - $tableName = strtolower($module) . '_' . strtolower($codeName); |
|
98 | - $tableCols = $this->parseColsForTable($options['cols'], strtolower($codeName) . '_', $tableName); |
|
97 | + $tableName = strtolower($module).'_'.strtolower($codeName); |
|
98 | + $tableCols = $this->parseColsForTable($options['cols'], strtolower($codeName).'_', $tableName); |
|
99 | 99 | if (App::$cur->db->tableExist($tableName)) { |
100 | 100 | foreach ($tableCols as $colKey => $params) { |
101 | 101 | App::$cur->db->add_col($tableName, $colKey, $params); |
@@ -107,15 +107,15 @@ discard block |
||
107 | 107 | $class->addProperty('objectName', $name, true); |
108 | 108 | $class->addProperty('cols', $modelCols['cols'], true); |
109 | 109 | $class->addProperty('labels', $modelCols['labels'], true); |
110 | - $class->addMethod('relations', 'return ' . CodeGenerator::genArray($modelCols['relations']), [], true); |
|
111 | - $modelCode = "<?php \n\nnamespace {$module};\n\n" . $class->generate(); |
|
110 | + $class->addMethod('relations', 'return '.CodeGenerator::genArray($modelCols['relations']), [], true); |
|
111 | + $modelCode = "<?php \n\nnamespace {$module};\n\n".$class->generate(); |
|
112 | 112 | |
113 | 113 | $modulePath = Module::getModulePath($module); |
114 | - Tools::createDir($modulePath . '/models'); |
|
115 | - file_put_contents($modulePath . '/models/' . $codeName . '.php', $modelCode); |
|
116 | - $config = Config::custom($modulePath . '/generatorHash.php'); |
|
117 | - $config['models/' . $codeName . '.php'] = md5($modelCode); |
|
118 | - Config::save($modulePath . '/generatorHash.php', $config); |
|
114 | + Tools::createDir($modulePath.'/models'); |
|
115 | + file_put_contents($modulePath.'/models/'.$codeName.'.php', $modelCode); |
|
116 | + $config = Config::custom($modulePath.'/generatorHash.php'); |
|
117 | + $config['models/'.$codeName.'.php'] = md5($modelCode); |
|
118 | + Config::save($modulePath.'/generatorHash.php', $config); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | public function install($module, $params = []) |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | |
136 | 136 | $type = 'modules'; |
137 | 137 | |
138 | - $path = INJI_SYSTEM_DIR . '/modules/'; |
|
138 | + $path = INJI_SYSTEM_DIR.'/modules/'; |
|
139 | 139 | $location = 'modules'; |
140 | 140 | |
141 | 141 | $config[$location][] = $module; |
@@ -148,8 +148,8 @@ discard block |
||
148 | 148 | } |
149 | 149 | } |
150 | 150 | Config::save('app', $config, null, App::$primary); |
151 | - if (file_exists($path . $module . '/install_script.php')) { |
|
152 | - $installFunction = include $path . $module . '/install_script.php'; |
|
151 | + if (file_exists($path.$module.'/install_script.php')) { |
|
152 | + $installFunction = include $path.$module.'/install_script.php'; |
|
153 | 153 | $installFunction(1, $params); |
154 | 154 | } |
155 | 155 | } |
@@ -178,8 +178,8 @@ discard block |
||
178 | 178 | $info = Modules::getInfo($module); |
179 | 179 | $moduleName = !empty($info['name']) ? $info['name'] : $module; |
180 | 180 | foreach ($modelsNames as $modelName) { |
181 | - $fullModelName = $module . '\\' . $modelName; |
|
182 | - $models[$fullModelName] = $moduleName . ' - ' . ($fullModelName::$objectName ? $fullModelName::$objectName : $modelName); |
|
181 | + $fullModelName = $module.'\\'.$modelName; |
|
182 | + $models[$fullModelName] = $moduleName.' - '.($fullModelName::$objectName ? $fullModelName::$objectName : $modelName); |
|
183 | 183 | } |
184 | 184 | } |
185 | 185 | foreach (App::$primary->config['modules'] as $configModule) { |
@@ -190,9 +190,9 @@ discard block |
||
190 | 190 | $info = Modules::getInfo($configModule); |
191 | 191 | $moduleName = !empty($info['name']) ? $info['name'] : $configModule; |
192 | 192 | foreach ($modelsNames as $modelName) { |
193 | - $fullModelName = $configModule . '\\' . $modelName; |
|
193 | + $fullModelName = $configModule.'\\'.$modelName; |
|
194 | 194 | Router::loadClass($fullModelName); |
195 | - $models[$fullModelName] = $moduleName . ' - ' . ($fullModelName::$objectName ? $fullModelName::$objectName : $modelName); |
|
195 | + $models[$fullModelName] = $moduleName.' - '.($fullModelName::$objectName ? $fullModelName::$objectName : $modelName); |
|
196 | 196 | } |
197 | 197 | } |
198 | 198 | return $models; |
@@ -201,16 +201,16 @@ discard block |
||
201 | 201 | public function getModelsList($module, $dir = '') |
202 | 202 | { |
203 | 203 | $modulePath = Module::getModulePath($module); |
204 | - $path = rtrim($modulePath . '/models/' . $dir, '/'); |
|
204 | + $path = rtrim($modulePath.'/models/'.$dir, '/'); |
|
205 | 205 | $models = []; |
206 | 206 | if (file_exists($path)) { |
207 | 207 | foreach (array_slice(scandir($path), 2) as $file) { |
208 | 208 | $modelLastName = pathinfo($file, PATHINFO_FILENAME); |
209 | - if (is_dir($path . '/' . $file)) { |
|
210 | - $models = array_merge($models, $this->getModelsList($module, $dir . '/' . $modelLastName)); |
|
209 | + if (is_dir($path.'/'.$file)) { |
|
210 | + $models = array_merge($models, $this->getModelsList($module, $dir.'/'.$modelLastName)); |
|
211 | 211 | } |
212 | - $nameSpace = trim(preg_replace('!/' . $modelLastName . '$!', '', $dir), '/'); |
|
213 | - $models[] = trim(str_replace('/', '\\', $nameSpace) . '\\' . $modelLastName, '\\'); |
|
212 | + $nameSpace = trim(preg_replace('!/'.$modelLastName.'$!', '', $dir), '/'); |
|
213 | + $models[] = trim(str_replace('/', '\\', $nameSpace).'\\'.$modelLastName, '\\'); |
|
214 | 214 | } |
215 | 215 | } |
216 | 216 | return $models; |
@@ -219,30 +219,30 @@ discard block |
||
219 | 219 | public function createController($module, $controllerType) |
220 | 220 | { |
221 | 221 | $modulePath = Module::getModulePath($module); |
222 | - $path = $modulePath . '/' . $controllerType . '/' . $module . 'Controller.php'; |
|
222 | + $path = $modulePath.'/'.$controllerType.'/'.$module.'Controller.php'; |
|
223 | 223 | $class = new CodeGenerator\ClassGenerator(); |
224 | - $class->name = $module . 'Controller'; |
|
224 | + $class->name = $module.'Controller'; |
|
225 | 225 | $class->extends = 'Controller'; |
226 | - $controllerCode = "<?php\n\n" . $class->generate(); |
|
226 | + $controllerCode = "<?php\n\n".$class->generate(); |
|
227 | 227 | Tools::createDir(pathinfo($path, PATHINFO_DIRNAME)); |
228 | 228 | file_put_contents($path, $controllerCode); |
229 | - $config = Config::custom($modulePath . '/generatorHash.php'); |
|
230 | - $config[$controllerType . '/' . $module . 'Controller.php'] = md5($controllerCode); |
|
231 | - Config::save($modulePath . '/generatorHash.php', $config); |
|
229 | + $config = Config::custom($modulePath.'/generatorHash.php'); |
|
230 | + $config[$controllerType.'/'.$module.'Controller.php'] = md5($controllerCode); |
|
231 | + Config::save($modulePath.'/generatorHash.php', $config); |
|
232 | 232 | } |
233 | 233 | |
234 | 234 | public function addActionToController($module, $type, $controller, $url) |
235 | 235 | { |
236 | 236 | $modulePath = Module::getModulePath($module); |
237 | - $path = Modules::getModulePath($module) . '/' . $type . '/' . $controller . '.php'; |
|
237 | + $path = Modules::getModulePath($module).'/'.$type.'/'.$controller.'.php'; |
|
238 | 238 | $class = CodeGenerator::parseClass($path); |
239 | - $class->addMethod($url . 'Action'); |
|
240 | - $controllerCode = "<?php\n\n" . $class->generate(); |
|
239 | + $class->addMethod($url.'Action'); |
|
240 | + $controllerCode = "<?php\n\n".$class->generate(); |
|
241 | 241 | Tools::createDir(pathinfo($path, PATHINFO_DIRNAME)); |
242 | 242 | file_put_contents($path, $controllerCode); |
243 | - $config = Config::custom($modulePath . '/generatorHash.php'); |
|
244 | - $config[$type . '/' . $module . 'Controller.php'] = md5($controllerCode); |
|
245 | - Config::save($modulePath . '/generatorHash.php', $config); |
|
243 | + $config = Config::custom($modulePath.'/generatorHash.php'); |
|
244 | + $config[$type.'/'.$module.'Controller.php'] = md5($controllerCode); |
|
245 | + Config::save($modulePath.'/generatorHash.php', $config); |
|
246 | 246 | } |
247 | 247 | |
248 | 248 | } |
@@ -5,13 +5,13 @@ |
||
5 | 5 | class <?= $codeName; ?> extends \Model { |
6 | 6 | //modelParams<?php |
7 | 7 | if (!empty($name)) { |
8 | - echo "\n static " . '$objectName = \'' . $name . "';"; |
|
8 | + echo "\n static ".'$objectName = \''.$name."';"; |
|
9 | 9 | } |
10 | 10 | if (!empty($labels)) { |
11 | - echo "\n static " . '$labels = [' . CodeGenerator::genArray($labels, 1) . "\n ];"; |
|
11 | + echo "\n static ".'$labels = ['.CodeGenerator::genArray($labels, 1)."\n ];"; |
|
12 | 12 | } |
13 | 13 | if (!empty($cols)) { |
14 | - echo "\n static " . '$cols = [' . CodeGenerator::genArray($cols, 1) . "\n ];"; |
|
14 | + echo "\n static ".'$cols = ['.CodeGenerator::genArray($cols, 1)."\n ];"; |
|
15 | 15 | } |
16 | 16 | ?> |
17 | 17 | //!modelParams |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | { |
58 | 58 | $amount = (float) $amount; |
59 | 59 | $query = \App::$cur->db->newQuery(); |
60 | - $string = 'UPDATE ' . \App::$cur->db->table_prefix . $this->table() . ' SET `' . $this->colPrefix() . 'amount`=`' . $this->colPrefix() . 'amount`+' . $amount . ' where `' . $this->index() . '` = ' . $this->id; |
|
60 | + $string = 'UPDATE '.\App::$cur->db->table_prefix.$this->table().' SET `'.$this->colPrefix().'amount`=`'.$this->colPrefix().'amount`+'.$amount.' where `'.$this->index().'` = '.$this->id; |
|
61 | 61 | $query->query($string); |
62 | 62 | $history = new Wallet\History(); |
63 | 63 | $history->wallet_id = $this->pk(); |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | { |
78 | 78 | switch ($this->currency->round_type) { |
79 | 79 | case 'floor': |
80 | - $dif = (float) ('1' . str_repeat('0', $this->currency->round_precision)); |
|
80 | + $dif = (float) ('1'.str_repeat('0', $this->currency->round_precision)); |
|
81 | 81 | return floor($this->amount * $dif) / $dif; |
82 | 82 | default : |
83 | 83 | return $this->amount; |
@@ -63,7 +63,7 @@ |
||
63 | 63 | public function checkBlocked() |
64 | 64 | { |
65 | 65 | $blocked = Wallet\Block::getList(['where' => [ |
66 | - ['data', 'reward:' . $this->id], |
|
66 | + ['data', 'reward:'.$this->id], |
|
67 | 67 | [ |
68 | 68 | ['date_expired', '0000-00-00 00:00:00'], |
69 | 69 | ['date_expired', date('Y-m-d H:i:s'), '>', 'OR'] |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | |
39 | 39 | public static function itemName($item) |
40 | 40 | { |
41 | - return $item->pk() . '. ' . $item->name(); |
|
41 | + return $item->pk().'. '.$item->name(); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | public static $dataManagers = [ |
@@ -48,16 +48,16 @@ discard block |
||
48 | 48 | ], |
49 | 49 | 'name' => 'Переводы', |
50 | 50 | 'cols' => [ |
51 | - 'user_id', 'to_user_id', 'currency_id', 'amount', 'comment', 'complete', 'canceled','date_create' |
|
51 | + 'user_id', 'to_user_id', 'currency_id', 'amount', 'comment', 'complete', 'canceled', 'date_create' |
|
52 | 52 | ], |
53 | 53 | 'actions' => [ |
54 | 54 | 'Money\CancelTransfer', 'Money\CompleteTransfer' |
55 | 55 | ], |
56 | 56 | 'sortable' => [ |
57 | - 'user_id', 'to_user_id', 'currency_id', 'amount', 'comment', 'complete', 'canceled','date_create' |
|
57 | + 'user_id', 'to_user_id', 'currency_id', 'amount', 'comment', 'complete', 'canceled', 'date_create' |
|
58 | 58 | ], |
59 | 59 | 'filters' => [ |
60 | - 'user_id', 'to_user_id', 'currency_id', 'amount', 'comment', 'complete', 'canceled','date_create' |
|
60 | + 'user_id', 'to_user_id', 'currency_id', 'amount', 'comment', 'complete', 'canceled', 'date_create' |
|
61 | 61 | ] |
62 | 62 | ] |
63 | 63 | ]; |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | |
183 | 183 | public function name() |
184 | 184 | { |
185 | - return 'Перевод на сумму ' . $this->amount . ' ' . $this->currency->name . ' от ' . $this->user->name() . ' для ' . $this->toUser->name(); |
|
185 | + return 'Перевод на сумму '.$this->amount.' '.$this->currency->name.' от '.$this->user->name().' для '.$this->toUser->name(); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | public function cancel() |
@@ -192,14 +192,14 @@ discard block |
||
192 | 192 | } |
193 | 193 | |
194 | 194 | $this->canceled = 1; |
195 | - $block = \Money\Wallet\Block::get('Money\Transfer:' . $this->id, 'data'); |
|
195 | + $block = \Money\Wallet\Block::get('Money\Transfer:'.$this->id, 'data'); |
|
196 | 196 | if ($block) { |
197 | 197 | $block->delete(); |
198 | 198 | } |
199 | 199 | $wallets = \App::$cur->money->getUserWallets($this->user_id); |
200 | 200 | $text = 'Отмена перевода средств'; |
201 | 201 | $wallets[$this->currency_id]->diff($this->amount, $text); |
202 | - \App::$cur->users->AddUserActivity($this->user_id, 4, $text . '<br />' . (float) $this->amount . ' ' . $wallets[$this->currency_id]->currency->acronym()); |
|
202 | + \App::$cur->users->AddUserActivity($this->user_id, 4, $text.'<br />'.(float) $this->amount.' '.$wallets[$this->currency_id]->currency->acronym()); |
|
203 | 203 | $this->save(); |
204 | 204 | return true; |
205 | 205 | } |
@@ -211,14 +211,14 @@ discard block |
||
211 | 211 | } |
212 | 212 | |
213 | 213 | $this->complete = 1; |
214 | - $block = \Money\Wallet\Block::get('Money\Transfer:' . $this->id, 'data'); |
|
214 | + $block = \Money\Wallet\Block::get('Money\Transfer:'.$this->id, 'data'); |
|
215 | 215 | if ($block) { |
216 | 216 | $block->delete(); |
217 | 217 | } |
218 | 218 | $wallets = \App::$cur->money->getUserWallets($this->to_user_id); |
219 | - $text = 'Перевод средств от ' . $this->user->name() . '.' . ($this->comment ? ' Комментарий:' . $this->comment : ''); |
|
219 | + $text = 'Перевод средств от '.$this->user->name().'.'.($this->comment ? ' Комментарий:'.$this->comment : ''); |
|
220 | 220 | $wallets[$this->currency_id]->diff($this->amount, $text); |
221 | - \App::$cur->users->AddUserActivity($this->to_user_id, 4, $text . '<br />' . (float) $this->amount . ' ' . $wallets[$this->currency_id]->currency->acronym()); |
|
221 | + \App::$cur->users->AddUserActivity($this->to_user_id, 4, $text.'<br />'.(float) $this->amount.' '.$wallets[$this->currency_id]->currency->acronym()); |
|
222 | 222 | $this->save(); |
223 | 223 | return true; |
224 | 224 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -return function ($step = NULL, $params = []) { |
|
3 | +return function($step = NULL, $params = []) { |
|
4 | 4 | |
5 | 5 | $currencies = [ |
6 | 6 | [ |
@@ -46,22 +46,22 @@ discard block |
||
46 | 46 | [ |
47 | 47 | 'name' => 'Wallet One', |
48 | 48 | 'object_name' => 'WalletOne', |
49 | - 'image_file_id' => App::$cur->Files->uploadFromUrl(__DIR__ . '/static/images/WalletOne.png') |
|
49 | + 'image_file_id' => App::$cur->Files->uploadFromUrl(__DIR__.'/static/images/WalletOne.png') |
|
50 | 50 | ], |
51 | 51 | [ |
52 | 52 | 'name' => 'Robokassa', |
53 | 53 | 'object_name' => 'Robokassa', |
54 | - 'image_file_id' => App::$cur->Files->uploadFromUrl(__DIR__ . '/static/images/Robokassa.png') |
|
54 | + 'image_file_id' => App::$cur->Files->uploadFromUrl(__DIR__.'/static/images/Robokassa.png') |
|
55 | 55 | ], |
56 | 56 | [ |
57 | 57 | 'name' => 'Payeer', |
58 | 58 | 'object_name' => 'Payeer', |
59 | - 'image_file_id' => App::$cur->Files->uploadFromUrl(__DIR__ . '/static/images/Payeer.png') |
|
59 | + 'image_file_id' => App::$cur->Files->uploadFromUrl(__DIR__.'/static/images/Payeer.png') |
|
60 | 60 | ], |
61 | 61 | [ |
62 | 62 | 'name' => 'PerfectMoney', |
63 | 63 | 'object_name' => 'PerfectMoney', |
64 | - 'image_file_id' => App::$cur->Files->uploadFromUrl(__DIR__ . '/static/images/PerfectMoney.png') |
|
64 | + 'image_file_id' => App::$cur->Files->uploadFromUrl(__DIR__.'/static/images/PerfectMoney.png') |
|
65 | 65 | ], |
66 | 66 | ]; |
67 | 67 | $merchantsConfig = [ |
@@ -21,8 +21,8 @@ discard block |
||
21 | 21 | 'callback_method' => '' |
22 | 22 | ], null, [ |
23 | 23 | 'description' => 'Тестовый платеж', |
24 | - 'success' => 'http://' . INJI_DOMAIN_NAME . '/', |
|
25 | - 'false' => 'http://' . INJI_DOMAIN_NAME . '/' |
|
24 | + 'success' => 'http://'.INJI_DOMAIN_NAME.'/', |
|
25 | + 'false' => 'http://'.INJI_DOMAIN_NAME.'/' |
|
26 | 26 | ]); |
27 | 27 | } |
28 | 28 | |
@@ -122,9 +122,9 @@ discard block |
||
122 | 122 | Tools::redirect('/', 'Валюта для этого способа оплаты не найдена', 'danger'); |
123 | 123 | } |
124 | 124 | $merchantOptions = [ |
125 | - 'description' => $pay->description ? '#' . $pay->id . ' ' . $pay->description : 'Оплата счета №' . $pay->id . ' на сайте: ' . idn_to_utf8(INJI_DOMAIN_NAME), |
|
126 | - 'success' => 'http://' . INJI_DOMAIN_NAME . '/', |
|
127 | - 'false' => 'http://' . INJI_DOMAIN_NAME . '/' |
|
125 | + 'description' => $pay->description ? '#'.$pay->id.' '.$pay->description : 'Оплата счета №'.$pay->id.' на сайте: '.idn_to_utf8(INJI_DOMAIN_NAME), |
|
126 | + 'success' => 'http://'.INJI_DOMAIN_NAME.'/', |
|
127 | + 'false' => 'http://'.INJI_DOMAIN_NAME.'/' |
|
128 | 128 | ]; |
129 | 129 | |
130 | 130 | $this->Money->goToMerchant($pay, $merchant, $method, $merchantOptions); |