@@ -25,7 +25,8 @@ |
||
25 | 25 | if ($this->success) { |
26 | 26 | $return['content'] = $this->content; |
27 | 27 | $return['successMsg'] = $this->successMsg; |
28 | - } else { |
|
28 | + } |
|
29 | + else { |
|
29 | 30 | $return['error'] = $this->content; |
30 | 31 | } |
31 | 32 | if (!headers_sent()) { |
@@ -37,7 +37,7 @@ |
||
37 | 37 | $root->setAttribute("xmlns", "http://www.sitemaps.org/schemas/sitemap/0.9"); |
38 | 38 | $root = $xml->appendChild($root); |
39 | 39 | |
40 | - $addToXml = function ($xml, $parent, $nodeName, $text) { |
|
40 | + $addToXml = function($xml, $parent, $nodeName, $text) { |
|
41 | 41 | $node = $parent->appendChild($xml->createElement($nodeName)); |
42 | 42 | $node->appendChild($xml->createTextNode($text)); |
43 | 43 | return $node; |
@@ -1,14 +1,14 @@ |
||
1 | 1 | <h1>Установка модулей</h1> |
2 | 2 | <form> |
3 | 3 | <?php |
4 | - $config = Config::app(App::$primary ? App::$primary : App::$cur); |
|
5 | - $modules = array_flip(Module::getInstalled(App::$cur)); |
|
6 | - $systemModules = array_slice(scandir(INJI_SYSTEM_DIR . '/modules'), 2); |
|
7 | - foreach ($systemModules as $module) { |
|
8 | - $info = Module::getInfo($module); |
|
9 | - if (!$info || isset($modules[$module])) |
|
10 | - continue; |
|
11 | - ?> |
|
4 | + $config = Config::app(App::$primary ? App::$primary : App::$cur); |
|
5 | + $modules = array_flip(Module::getInstalled(App::$cur)); |
|
6 | + $systemModules = array_slice(scandir(INJI_SYSTEM_DIR . '/modules'), 2); |
|
7 | + foreach ($systemModules as $module) { |
|
8 | + $info = Module::getInfo($module); |
|
9 | + if (!$info || isset($modules[$module])) |
|
10 | + continue; |
|
11 | + ?> |
|
12 | 12 | <div class ="form-group"> |
13 | 13 | <div class="checkbox"> |
14 | 14 | <label> |
@@ -6,8 +6,9 @@ |
||
6 | 6 | $systemModules = array_slice(scandir(INJI_SYSTEM_DIR . '/modules'), 2); |
7 | 7 | foreach ($systemModules as $module) { |
8 | 8 | $info = Module::getInfo($module); |
9 | - if (!$info || isset($modules[$module])) |
|
10 | - continue; |
|
9 | + if (!$info || isset($modules[$module])) { |
|
10 | + continue; |
|
11 | + } |
|
11 | 12 | ?> |
12 | 13 | <div class ="form-group"> |
13 | 14 | <div class="checkbox"> |
@@ -38,7 +38,8 @@ |
||
38 | 38 | $codeName = ucfirst($codeName); |
39 | 39 | if (file_exists(App::$primary->path . '/modules/' . $codeName . '.php')) { |
40 | 40 | Msg::add('Модуль с таким именем уже существует'); |
41 | - } else { |
|
41 | + } |
|
42 | + else { |
|
42 | 43 | $this->modules->createBlankModule(filter_input(INPUT_POST, 'name'), $codeName); |
43 | 44 | $config = App::$primary->config; |
44 | 45 | $config['modules'][] = $codeName; |
@@ -62,7 +62,8 @@ |
||
62 | 62 | $parser = new $parserName; |
63 | 63 | $parser->param = $parent; |
64 | 64 | $values = $parser->editor(); |
65 | - } else { |
|
65 | + } |
|
66 | + else { |
|
66 | 67 | $values = [ |
67 | 68 | '' => 'Выберите', |
68 | 69 | 'continue' => 'Пропустить', |
@@ -19,7 +19,8 @@ discard block |
||
19 | 19 | if (is_numeric($objectType)) { |
20 | 20 | $mapPath->object_id = $objectType; |
21 | 21 | $mapPath->type = 'object'; |
22 | - } else { |
|
22 | + } |
|
23 | + else { |
|
23 | 24 | if ($objectType == 'object') { |
24 | 25 | $object = new Migrations\Migration\Object(); |
25 | 26 | $object->model = !empty($_POST['typeOptions'][$pathId]) ? $_POST['typeOptions'][$pathId] : ''; |
@@ -28,7 +29,8 @@ discard block |
||
28 | 29 | $object->save(); |
29 | 30 | $mapPath->type = 'object'; |
30 | 31 | $mapPath->object_id = $object->id; |
31 | - } else { |
|
32 | + } |
|
33 | + else { |
|
32 | 34 | $mapPath->type = $objectType; |
33 | 35 | } |
34 | 36 | } |
@@ -48,7 +50,8 @@ discard block |
||
48 | 50 | $object->save(); |
49 | 51 | $param->type = 'object'; |
50 | 52 | $param->value = $object->id; |
51 | - } else { |
|
53 | + } |
|
54 | + else { |
|
52 | 55 | $param->type = $type; |
53 | 56 | $param->value = !empty($_POST['paramOptions'][$paramId]) ? $_POST['paramOptions'][$paramId] : ''; |
54 | 57 | } |
@@ -28,7 +28,8 @@ discard block |
||
28 | 28 | $ids[] = $id; |
29 | 29 | } |
30 | 30 | } |
31 | - } else { |
|
31 | + } |
|
32 | + else { |
|
32 | 33 | $id = $this->parseData($this->data, $preset); |
33 | 34 | if ($id) { |
34 | 35 | $ids[] = $id; |
@@ -56,10 +57,12 @@ discard block |
||
56 | 57 | $parser->parentModel = $model; |
57 | 58 | $parser->walker = $this->walker; |
58 | 59 | $parser->parse(); |
59 | - } else { |
|
60 | + } |
|
61 | + else { |
|
60 | 62 | if ($param->type == 'custom') { |
61 | 63 | $parserName = $param->value; |
62 | - } else { |
|
64 | + } |
|
65 | + else { |
|
63 | 66 | $parserName = '\Migrations\Parser\Object\\' . ucfirst($param->type); |
64 | 67 | } |
65 | 68 | $parser = new $parserName; |
@@ -105,7 +108,8 @@ discard block |
||
105 | 108 | if ($param->type == 'item_key') { |
106 | 109 | $keyCol = $param->code; |
107 | 110 | break; |
108 | - } elseif (!empty($options['unique'])) { |
|
111 | + } |
|
112 | + elseif (!empty($options['unique'])) { |
|
109 | 113 | $uniques[$param->code] = $param; |
110 | 114 | } |
111 | 115 | } |
@@ -114,7 +118,8 @@ discard block |
||
114 | 118 | if ($objectId) { |
115 | 119 | $modelName = $this->object->model; |
116 | 120 | $model = $modelName::get($objectId->object_id); |
117 | - } else { |
|
121 | + } |
|
122 | + else { |
|
118 | 123 | $model = new $this->object->model; |
119 | 124 | $model->save(['empty' => true]); |
120 | 125 | $objectId = new \Migrations\Id(); |
@@ -125,7 +130,8 @@ discard block |
||
125 | 130 | \App::$cur->migrations->ids['objectIds'][$this->object->model][$model->id] = $objectId; |
126 | 131 | \App::$cur->migrations->ids['parseIds'][$this->object->model][(string) $data[$keyCol]] = $objectId; |
127 | 132 | } |
128 | - } elseif ($uniques) { |
|
133 | + } |
|
134 | + elseif ($uniques) { |
|
129 | 135 | $where = []; |
130 | 136 | foreach ($uniques as $code => $param) { |
131 | 137 | if (!isset($data[$code])) { |
@@ -168,7 +174,8 @@ discard block |
||
168 | 174 | if (!empty($relation['type']) && $relation['type'] == 'many') { |
169 | 175 | $where[] = [$relation['col'], $this->parentModel->pk()]; |
170 | 176 | } |
171 | - } elseif ($this->parentObject) { |
|
177 | + } |
|
178 | + elseif ($this->parentObject) { |
|
172 | 179 | $modelName = $this->parentObject->object->model; |
173 | 180 | $where[] = [$modelName::index(), $this->parentModel->pk()]; |
174 | 181 | } |
@@ -23,7 +23,8 @@ discard block |
||
23 | 23 | if ($this->model) { |
24 | 24 | if ($param->type == 'custom') { |
25 | 25 | $parserName = $param->value; |
26 | - } else { |
|
26 | + } |
|
27 | + else { |
|
27 | 28 | $parserName = '\Migrations\Parser\Object\\' . ucfirst($param->type); |
28 | 29 | } |
29 | 30 | if (!\Tools::isAssoc($this->data)) { |
@@ -35,7 +36,8 @@ discard block |
||
35 | 36 | $parser->object = $this->object; |
36 | 37 | $parser->parse(); |
37 | 38 | } |
38 | - } else { |
|
39 | + } |
|
40 | + else { |
|
39 | 41 | $parser = new $parserName; |
40 | 42 | $parser->data = &$this->data[$param->code]; |
41 | 43 | $parser->param = $param; |
@@ -52,7 +52,8 @@ discard block |
||
52 | 52 | } |
53 | 53 | $ids = array_merge($ids, $objectParser->parse([$relation['col'] => $this->model->pk()])); |
54 | 54 | } |
55 | - } else { |
|
55 | + } |
|
56 | + else { |
|
56 | 57 | $objectParser = new \Migrations\Parser\Object(); |
57 | 58 | $objectParser->object = $object; |
58 | 59 | $objectParser->parentObject = $this->object; |
@@ -85,7 +86,8 @@ discard block |
||
85 | 86 | $delObject->delete(); |
86 | 87 | } |
87 | 88 | } |
88 | - } else { |
|
89 | + } |
|
90 | + else { |
|
89 | 91 | $objectParser = new \Migrations\Parser\Object(); |
90 | 92 | $objectParser->object = $object; |
91 | 93 | $objectParser->parentObject = $this->object; |
@@ -100,7 +102,8 @@ discard block |
||
100 | 102 | $ids[] = $model->id; |
101 | 103 | } |
102 | 104 | } |
103 | - } else { |
|
105 | + } |
|
106 | + else { |
|
104 | 107 | $model = $objectParser->setModel($this->data); |
105 | 108 | if ($model && $model->id) { |
106 | 109 | $ids[] = $model->id; |