Completed
Push — master ( 0afdc4...0e57e6 )
by Alexey
04:27
created
system/modules/Ecommerce/models/Delivery.php 1 patch
Indentation   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -13,65 +13,65 @@  discard block
 block discarded – undo
13 13
 
14 14
 class Delivery extends \Model {
15 15
 
16
-  public static $objectName = 'Доставка';
17
-  public static $cols = [
18
-      //Основные параметры
19
-      'name' => ['type' => 'text'],
20
-      'price' => ['type' => 'decimal'],
21
-      'currency_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'currency'],
22
-      'price_text' => ['type' => 'textarea'],
23
-      'max_cart_price' => ['type' => 'decimal'],
24
-      'icon_file_id' => ['type' => 'image'],
25
-      'info' => ['type' => 'html'],
26
-      'disabled' => ['type' => 'bool'],
27
-      //Системные
28
-      'weight' => ['type' => 'number'],
29
-      'date_create' => ['type' => 'dateTime'],
30
-      //Менеджеры
31
-      'field' => ['type' => 'dataManager', 'relation' => 'fields'],
32
-      'priceChanger' => ['type' => 'dataManager', 'relation' => 'prices']
33
-  ];
34
-  public static $labels = [
35
-      'name' => 'Название',
36
-      'price' => 'Стоимость',
37
-      'price_text' => 'Текстовое описание стоимости (отображается вместо цены)',
38
-      'max_cart_price' => 'Басплатно при',
39
-      'icon_file_id' => 'Иконка',
40
-      'currency_id' => 'Валюта',
41
-      'info' => 'Дополнительная информация',
42
-      'priceChanger' => 'Градация стоимости',
43
-      'field' => 'Поля',
44
-      'disabled' => 'Отключено',
45
-  ];
46
-  public static $dataManagers = [
47
-      'manager' => [
48
-          'name' => 'Варианты доставки',
49
-          'cols' => [
50
-              'name',
51
-              'price',
52
-              'currency_id',
53
-              'max_cart_price',
54
-              'disabled',
55
-              'field',
56
-              'priceChanger',
57
-          ],
58
-          'sortMode' => true
59
-      ],
60
-  ];
61
-  public static $forms = [
62
-      'manager' => [
63
-          'map' => [
64
-              ['name', 'disabled'],
65
-              ['max_cart_price', 'icon_file_id'],
66
-              ['price', 'currency_id'],
67
-              ['price_text'],
68
-              ['info'],
69
-              ['priceChanger'],
70
-              ['field']
71
-          ]
72
-  ]];
16
+    public static $objectName = 'Доставка';
17
+    public static $cols = [
18
+        //Основные параметры
19
+        'name' => ['type' => 'text'],
20
+        'price' => ['type' => 'decimal'],
21
+        'currency_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'currency'],
22
+        'price_text' => ['type' => 'textarea'],
23
+        'max_cart_price' => ['type' => 'decimal'],
24
+        'icon_file_id' => ['type' => 'image'],
25
+        'info' => ['type' => 'html'],
26
+        'disabled' => ['type' => 'bool'],
27
+        //Системные
28
+        'weight' => ['type' => 'number'],
29
+        'date_create' => ['type' => 'dateTime'],
30
+        //Менеджеры
31
+        'field' => ['type' => 'dataManager', 'relation' => 'fields'],
32
+        'priceChanger' => ['type' => 'dataManager', 'relation' => 'prices']
33
+    ];
34
+    public static $labels = [
35
+        'name' => 'Название',
36
+        'price' => 'Стоимость',
37
+        'price_text' => 'Текстовое описание стоимости (отображается вместо цены)',
38
+        'max_cart_price' => 'Басплатно при',
39
+        'icon_file_id' => 'Иконка',
40
+        'currency_id' => 'Валюта',
41
+        'info' => 'Дополнительная информация',
42
+        'priceChanger' => 'Градация стоимости',
43
+        'field' => 'Поля',
44
+        'disabled' => 'Отключено',
45
+    ];
46
+    public static $dataManagers = [
47
+        'manager' => [
48
+            'name' => 'Варианты доставки',
49
+            'cols' => [
50
+                'name',
51
+                'price',
52
+                'currency_id',
53
+                'max_cart_price',
54
+                'disabled',
55
+                'field',
56
+                'priceChanger',
57
+            ],
58
+            'sortMode' => true
59
+        ],
60
+    ];
61
+    public static $forms = [
62
+        'manager' => [
63
+            'map' => [
64
+                ['name', 'disabled'],
65
+                ['max_cart_price', 'icon_file_id'],
66
+                ['price', 'currency_id'],
67
+                ['price_text'],
68
+                ['info'],
69
+                ['priceChanger'],
70
+                ['field']
71
+            ]
72
+    ]];
73 73
 
74
-  public static function relations() {
74
+    public static function relations() {
75 75
     return [
76 76
         'icon' => [
77 77
             'model' => 'Files\File',
@@ -92,6 +92,6 @@  discard block
 block discarded – undo
92 92
             'col' => 'delivery_id'
93 93
         ]
94 94
     ];
95
-  }
95
+    }
96 96
 
97 97
 }
Please login to merge, or discard this patch.
system/modules/Dashboard/appAdminControllers/DashboardController.php 1 patch
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -10,38 +10,38 @@
 block discarded – undo
10 10
  */
11 11
 class DashboardController extends adminController {
12 12
 
13
-  public function indexAction() {
13
+    public function indexAction() {
14 14
     $sections = $this->module->getSnippets('adminDashboardWidget');
15 15
     $this->view->setTitle('Панель управления');
16 16
     $this->view->page(['data' => compact('sections')]);
17
-  }
17
+    }
18 18
 
19
-  public function siteConfigAction() {
19
+    public function siteConfigAction() {
20 20
     if (isset($_POST['site_name'])) {
21
-      $config = \App::$primary->config;
22
-      $config['site']['name'] = $_POST['site_name'];
23
-      $config['site']['company_name'] = $_POST['company_name'];
24
-      $config['site']['email'] = $_POST['site_email'];
25
-      $config['site']['keywords'] = $_POST['site_keywords'];
26
-      $config['site']['description'] = $_POST['site_description'];
27
-      $config['site']['domain'] = $_POST['site_domain'];
28
-      if (isset($_POST['metatags'])) {
21
+        $config = \App::$primary->config;
22
+        $config['site']['name'] = $_POST['site_name'];
23
+        $config['site']['company_name'] = $_POST['company_name'];
24
+        $config['site']['email'] = $_POST['site_email'];
25
+        $config['site']['keywords'] = $_POST['site_keywords'];
26
+        $config['site']['description'] = $_POST['site_description'];
27
+        $config['site']['domain'] = $_POST['site_domain'];
28
+        if (isset($_POST['metatags'])) {
29 29
         $config['site']['metatags'] = $_POST['metatags'];
30
-      }
31
-      if (!empty($_FILES['site_logo']['tmp_name'])) {
30
+        }
31
+        if (!empty($_FILES['site_logo']['tmp_name'])) {
32 32
         $fileId = $this->Files->upload($_FILES['site_logo'], array('file_code' => 'site_logo'));
33 33
         $config['site']['site_logo'] = Files\File::get($fileId)->path;
34
-      }
35
-      Config::save('app', $config);
36
-      Tools::redirect('/admin/dashboard/siteConfig', 'Изменения сохранены', 'success');
34
+        }
35
+        Config::save('app', $config);
36
+        Tools::redirect('/admin/dashboard/siteConfig', 'Изменения сохранены', 'success');
37 37
     }
38 38
 
39 39
     $this->view->setTitle('Общие настройки сайта');
40 40
     $this->view->page();
41
-  }
41
+    }
42 42
 
43
-  public function phpInfoAction() {
43
+    public function phpInfoAction() {
44 44
     $this->view->page();
45
-  }
45
+    }
46 46
 
47 47
 }
Please login to merge, or discard this patch.
system/modules/Exchange1c/objects/Parser/Item/Options.php 1 patch
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -13,75 +13,75 @@
 block discarded – undo
13 13
 
14 14
 class Options extends \Migrations\Parser {
15 15
 
16
-  static $options;
16
+    static $options;
17 17
 
18
-  public function parse() {
18
+    public function parse() {
19 19
     if (!Options::$options) {
20
-      Options::$options = \Ecommerce\Item\Option::getList();
20
+        Options::$options = \Ecommerce\Item\Option::getList();
21 21
     }
22 22
     $options = [];
23 23
     $modelName = 'Ecommerce\Item\Option';
24 24
     foreach ($this->data['ЗначенияСвойства'] as $opt) {
25
-      $optionId = \App::$cur->migrations->ids['parseIds']['Ecommerce\Item\Option'][$opt['Ид']]->object_id;
26
-      if ($optionId && !isset(Options::$options[$optionId])) {
25
+        $optionId = \App::$cur->migrations->ids['parseIds']['Ecommerce\Item\Option'][$opt['Ид']]->object_id;
26
+        if ($optionId && !isset(Options::$options[$optionId])) {
27 27
         Options::$options = \Ecommerce\Item\Option::getList();
28
-      }
29
-      if (isset(Options::$options[$optionId]) && Options::$options[$optionId]->type == 'select') {
28
+        }
29
+        if (isset(Options::$options[$optionId]) && Options::$options[$optionId]->type == 'select') {
30 30
         if (empty($options[$optionId])) {
31
-          $options[$optionId] = [];
31
+            $options[$optionId] = [];
32 32
         } else {
33
-          if (!Options::$options[$optionId]->advance) {
33
+            if (!Options::$options[$optionId]->advance) {
34 34
             Options::$options[$optionId]->advance = ['multi' => true];
35 35
             Options::$options[$optionId]->save();
36
-          }
36
+            }
37 37
         }
38 38
         if ($opt['Значение'] && isset(\App::$cur->migrations->ids['parseIds']['Ecommerce\Item\Option\Item'][$opt['Значение']])) {
39
-          $options[$optionId][] = \App::$cur->migrations->ids['parseIds']['Ecommerce\Item\Option\Item'][$opt['Значение']]->object_id;
39
+            $options[$optionId][] = \App::$cur->migrations->ids['parseIds']['Ecommerce\Item\Option\Item'][$opt['Значение']]->object_id;
40 40
         }
41
-      } else {
41
+        } else {
42 42
         $options[$optionId] = $opt['Значение'];
43
-      }
43
+        }
44 44
     }
45 45
     $itemParams = \Ecommerce\Item\Param::getList(['where' => ['item_id', $this->model->id]]);
46 46
     foreach ($itemParams as $itemParam) {
47
-      if ($itemParam->item_option_id && !isset(Options::$options[$itemParam->item_option_id])) {
47
+        if ($itemParam->item_option_id && !isset(Options::$options[$itemParam->item_option_id])) {
48 48
         Options::$options = \Ecommerce\Item\Option::getList();
49
-      }
50
-      if (isset(Options::$options[$itemParam->item_option_id]) && Options::$options[$itemParam->item_option_id]->type == 'select') {
49
+        }
50
+        if (isset(Options::$options[$itemParam->item_option_id]) && Options::$options[$itemParam->item_option_id]->type == 'select') {
51 51
         if (empty($options[$itemParam->item_option_id]) || !in_array($itemParam->value, $options[$itemParam->item_option_id])) {
52
-          $itemParam->delete();
52
+            $itemParam->delete();
53 53
         } else {
54
-          unset($options[$itemParam->item_option_id][array_search($itemParam->value, $options[$itemParam->item_option_id])]);
54
+            unset($options[$itemParam->item_option_id][array_search($itemParam->value, $options[$itemParam->item_option_id])]);
55 55
         }
56
-      } else {
56
+        } else {
57 57
         if (empty($options[$itemParam->item_option_id])) {
58
-          $itemParam->delete();
58
+            $itemParam->delete();
59 59
         } else {
60
-          $itemParam->value = $options[$itemParam->item_option_id];
61
-          $itemParam->save();
62
-          unset($options[$itemParam->item_option_id]);
60
+            $itemParam->value = $options[$itemParam->item_option_id];
61
+            $itemParam->save();
62
+            unset($options[$itemParam->item_option_id]);
63
+        }
63 64
         }
64
-      }
65 65
     }
66 66
     foreach ($options as $optionId => $values) {
67
-      if (is_array($values)) {
67
+        if (is_array($values)) {
68 68
         foreach ($values as $value) {
69
-          $itemParam = new \Ecommerce\Item\Param([
70
-              'item_option_id' => $optionId,
71
-              'item_id' => $this->model->id,
72
-              'value' => $value
73
-          ]);
74
-          $itemParam->save();
69
+            $itemParam = new \Ecommerce\Item\Param([
70
+                'item_option_id' => $optionId,
71
+                'item_id' => $this->model->id,
72
+                'value' => $value
73
+            ]);
74
+            $itemParam->save();
75 75
         }
76
-      } else {
76
+        } else {
77 77
         $itemParam = new \Ecommerce\Item\Param([
78 78
             'item_option_id' => $optionId,
79 79
             'item_id' => $this->model->id,
80 80
             'value' => $values
81 81
         ]);
82 82
         $itemParam->save();
83
-      }
83
+        }
84
+    }
84 85
     }
85
-  }
86 86
 
87 87
 }
Please login to merge, or discard this patch.
system/modules/Migrations/Migrations.php 1 patch
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -12,10 +12,10 @@  discard block
 block discarded – undo
12 12
  */
13 13
 class Migrations extends \Module {
14 14
 
15
-  public $ids = [];
16
-  public $migrationObjects = [];
15
+    public $ids = [];
16
+    public $migrationObjects = [];
17 17
 
18
-  public function startMigration($migrationId, $mapId, $filePath) {
18
+    public function startMigration($migrationId, $mapId, $filePath) {
19 19
     $log = new \Migrations\Log();
20 20
     $log->migration_id = $migrationId;
21 21
     $log->migration_map_id = $mapId;
@@ -24,11 +24,11 @@  discard block
 block discarded – undo
24 24
 
25 25
     $reader = new Migrations\Reader\Xml();
26 26
     if (!$reader->loadData($filePath)) {
27
-      $event = new Migrations\Log\Event();
28
-      $event->log_id = $log->id;
29
-      $event->type = 'load_data_error';
30
-      $event->save();
31
-      return false;
27
+        $event = new Migrations\Log\Event();
28
+        $event->log_id = $log->id;
29
+        $event->type = 'load_data_error';
30
+        $event->save();
31
+        return false;
32 32
     }
33 33
     $walker = new \Migrations\Walker();
34 34
     $walker->migration = Migrations\Migration::get($migrationId);
@@ -38,43 +38,43 @@  discard block
 block discarded – undo
38 38
     $walker->walk();
39 39
     $log->result = 'success';
40 40
     $log->save();
41
-  }
41
+    }
42 42
 
43
-  public function loadParseIds($type) {
43
+    public function loadParseIds($type) {
44 44
     $this->ids['parseIds'][$type] = \Migrations\Id::getList(['where' => ['type', $type], 'key' => 'parse_id']);
45
-  }
45
+    }
46 46
 
47
-  public function loadObjectIds($type) {
47
+    public function loadObjectIds($type) {
48 48
     $this->ids['objectIds'][$type] = \Migrations\Id::getList(['where' => ['type', $type], 'key' => 'object_id']);
49
-  }
49
+    }
50 50
 
51
-  public function findObject($parseId, $type) {
51
+    public function findObject($parseId, $type) {
52 52
     if (empty($this->ids['parseIds'][$type])) {
53
-      $this->loadParseIds($type);
54
-      ksort($this->ids['parseIds'][$type]);
53
+        $this->loadParseIds($type);
54
+        ksort($this->ids['parseIds'][$type]);
55 55
     }
56 56
     if (!empty($this->ids['parseIds'][$type][$parseId])) {
57
-      return $this->ids['parseIds'][$type][$parseId];
57
+        return $this->ids['parseIds'][$type][$parseId];
58
+    }
58 59
     }
59
-  }
60 60
 
61
-  public function findParse($objectId, $type) {
61
+    public function findParse($objectId, $type) {
62 62
     if (empty($this->ids['objectIds'][$type])) {
63
-      $this->loadObjectIds($type);
64
-      ksort($this->ids['objectIds'][$type]);
63
+        $this->loadObjectIds($type);
64
+        ksort($this->ids['objectIds'][$type]);
65 65
     }
66 66
     if (!empty($this->ids['objectIds'][$type][$objectId])) {
67
-      return $this->ids['objectIds'][$type][$objectId];
67
+        return $this->ids['objectIds'][$type][$objectId];
68
+    }
68 69
     }
69
-  }
70 70
 
71
-  public function getMigrationObject($objectId) {
71
+    public function getMigrationObject($objectId) {
72 72
     if (empty($this->migrationObjects)) {
73
-      $this->migrationObjects = \Migrations\Migration\Object::getList();
73
+        $this->migrationObjects = \Migrations\Migration\Object::getList();
74 74
     }
75 75
     if (!empty($this->migrationObjects[$objectId])) {
76
-      return $this->migrationObjects[$objectId];
76
+        return $this->migrationObjects[$objectId];
77
+    }
77 78
     }
78
-  }
79 79
 
80 80
 }
Please login to merge, or discard this patch.
system/modules/Migrations/objects/Walker.php 1 patch
Indentation   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -13,61 +13,61 @@  discard block
 block discarded – undo
13 13
 
14 14
 class Walker {
15 15
 
16
-  public $migration = null;
17
-  public $map = null;
18
-  public $data = null;
19
-  public $mapPath = null;
20
-  public $mapPathParent = null;
21
-  public $curPath = '/';
22
-  public $migtarionLog = null;
16
+    public $migration = null;
17
+    public $map = null;
18
+    public $data = null;
19
+    public $mapPath = null;
20
+    public $mapPathParent = null;
21
+    public $curPath = '/';
22
+    public $migtarionLog = null;
23 23
 
24
-  //walk map pathes on cur path
25
-  public function walk() {
24
+    //walk map pathes on cur path
25
+    public function walk() {
26 26
     $walked = [];
27 27
     //walk know pathes
28 28
     foreach ($this->map->paths(['where' => ['path', $this->curPath]]) as $path) {
29
-      if (isset($this->data[$path->item])) {
29
+        if (isset($this->data[$path->item])) {
30 30
         if ($path->type == 'container') { //create walker for container
31
-          $walker = new Walker();
32
-          $walker->migration = $this->migration;
33
-          $walker->map = $this->map;
34
-          $walker->data = &$this->data[$path->item];
35
-          $walker->curPath = $this->curPath . $path->item . '/';
36
-          $walker->mapPath = $path;
37
-          $walker->mapPathParent = $this->mapPath;
38
-          $walker->migtarionLog = $this->migtarionLog;
39
-          $walker->walk();
31
+            $walker = new Walker();
32
+            $walker->migration = $this->migration;
33
+            $walker->map = $this->map;
34
+            $walker->data = &$this->data[$path->item];
35
+            $walker->curPath = $this->curPath . $path->item . '/';
36
+            $walker->mapPath = $path;
37
+            $walker->mapPathParent = $this->mapPath;
38
+            $walker->migtarionLog = $this->migtarionLog;
39
+            $walker->walk();
40 40
         } elseif ($path->type == 'object') { //start parse path data
41
-          $this->startObjectParse($path->object_id, $this->data[$path->item]);
41
+            $this->startObjectParse($path->object_id, $this->data[$path->item]);
42 42
         }
43
-      }
44
-      $walked[$path->item] = true;
43
+        }
44
+        $walked[$path->item] = true;
45 45
     }
46 46
     //check unparsed paths
47 47
     foreach ($this->data as $key => &$data) {
48
-      //skip parsed and attribtes
49
-      if ($key == '@attributes' || !empty($walked[$key])) {
48
+        //skip parsed and attribtes
49
+        if ($key == '@attributes' || !empty($walked[$key])) {
50 50
         continue;
51
-      }
52
-      //search object for parse
53
-      $object = Migration\Object::get([
54
-                  ['code', $key],
55
-                  ['migration_id', $this->migration->id]
56
-      ]);
57
-      if ($object) { //parse as object
51
+        }
52
+        //search object for parse
53
+        $object = Migration\Object::get([
54
+                    ['code', $key],
55
+                    ['migration_id', $this->migration->id]
56
+        ]);
57
+        if ($object) { //parse as object
58 58
         $this->startObjectParse($object, $data);
59
-      } else { //create new map path for configure unknown path
59
+        } else { //create new map path for configure unknown path
60 60
         $this->mapPath = new Migration\Map\Path();
61 61
         $this->mapPath->parent_id = $this->mapPathParent ? $this->mapPathParent->id : 0;
62 62
         $this->mapPath->path = $this->curPath;
63 63
         $this->mapPath->item = $key;
64 64
         $this->mapPath->migration_map_id = $this->map->id;
65 65
         $this->mapPath->save();
66
-      }
66
+        }
67
+    }
67 68
     }
68
-  }
69 69
 
70
-  private function startObjectParse($object_id, &$data) {
70
+    private function startObjectParse($object_id, &$data) {
71 71
     $objectParser = new Parser\Object();
72 72
     $objectParser->object = is_object($object_id) ? $object_id : \App::$cur->migrations->getMigrationObject($object_id);
73 73
     $objectParser->data = $data;
@@ -76,33 +76,33 @@  discard block
 block discarded – undo
76 76
 
77 77
     if ($objectParser->object->clear && json_decode($objectParser->object->clear, true)) {
78 78
 
79
-      $where = json_decode($objectParser->object->clear, true);
80
-      if (!$where) {
79
+        $where = json_decode($objectParser->object->clear, true);
80
+        if (!$where) {
81 81
         $where = [];
82
-      } else {
82
+        } else {
83 83
         $where = [[$where]];
84
-      }
85
-      if ($ids) {
84
+        }
85
+        if ($ids) {
86 86
         $where[] = ['id', implode(',', $ids), 'NOT IN'];
87
-      }
88
-      if (empty(\App::$cur->migrations->ids['objectIds'])) {
87
+        }
88
+        if (empty(\App::$cur->migrations->ids['objectIds'])) {
89 89
         \App::$cur->migrations->loadObjectIds($objectParser->object->model);
90
-      }
91
-      if (!empty(\App::$cur->migrations->ids['objectIds'][$objectParser->object->model])) {
90
+        }
91
+        if (!empty(\App::$cur->migrations->ids['objectIds'][$objectParser->object->model])) {
92 92
         $where[] = ['id', implode(',', array_keys(\App::$cur->migrations->ids['objectIds'][$objectParser->object->model])), 'IN'];
93
-      }
94
-      $modelName = $objectParser->object->model;
95
-      $objects = $modelName::getList(['where' => $where]);
96
-      foreach ($objects as $object) {
93
+        }
94
+        $modelName = $objectParser->object->model;
95
+        $objects = $modelName::getList(['where' => $where]);
96
+        foreach ($objects as $object) {
97 97
         $objectId = \App::$cur->migrations->findParse($object->id, $objectParser->object->model);
98 98
         if ($objectId) {
99
-          $objectId->delete();
100
-          unset(\App::$cur->migrations->ids['objectIds'][$objectParser->object->model][$object->id]);
101
-          unset(\App::$cur->migrations->ids['parseIds'][$objectParser->object->model][$objectId->parse_id]);
99
+            $objectId->delete();
100
+            unset(\App::$cur->migrations->ids['objectIds'][$objectParser->object->model][$object->id]);
101
+            unset(\App::$cur->migrations->ids['parseIds'][$objectParser->object->model][$objectId->parse_id]);
102 102
         }
103 103
         $object->delete();
104
-      }
104
+        }
105
+    }
105 106
     }
106
-  }
107 107
 
108 108
 }
Please login to merge, or discard this patch.
system/modules/Ui/widgets/Form/select.php 1 patch
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -4,36 +4,36 @@  discard block
 block discarded – undo
4 4
 $optionsHtml = '';
5 5
 
6 6
 foreach ($options['values'] as $key => $value) {
7
-  $selected = '';
7
+    $selected = '';
8 8
 
9
-  $primaryValue = isset($options['value']) ? $options['value'] : null;
10
-  $primaryValue = is_array($primaryValue) && isset($primaryValue['primary']) ? $primaryValue['primary'] : $primaryValue;
11
-  if (is_numeric($key) && !is_array($primaryValue) && $primaryValue !== '') {
9
+    $primaryValue = isset($options['value']) ? $options['value'] : null;
10
+    $primaryValue = is_array($primaryValue) && isset($primaryValue['primary']) ? $primaryValue['primary'] : $primaryValue;
11
+    if (is_numeric($key) && !is_array($primaryValue) && $primaryValue !== '') {
12 12
     $primaryValue = (int) $primaryValue;
13
-  }
14
-  if (
15
-          (!is_array($primaryValue) && ($key === $primaryValue || (isset($form->userDataTree[$name]) && $form->userDataTree[$name] === $key))) ||
13
+    }
14
+    if (
15
+            (!is_array($primaryValue) && ($key === $primaryValue || (isset($form->userDataTree[$name]) && $form->userDataTree[$name] === $key))) ||
16 16
           (is_array($primaryValue) && (in_array($key, $primaryValue) || (isset($form->userDataTree[$name]) && in_array($key, $form->userDataTree[$name]))))
17
-  ) {
17
+    ) {
18 18
     $selected = ' selected="selected"';
19
-  }
20
-  if (is_array($value)) {
19
+    }
20
+    if (is_array($value)) {
21 21
     $aditionalInputs[] = $value['input'];
22 22
     if ($selected) {
23
-      $showedInput = count($aditionalInputs) - 1;
24
-      $aditionValue = !empty($options['aditionalValue']) ? $options['aditionalValue'] : '';
23
+        $showedInput = count($aditionalInputs) - 1;
24
+        $aditionValue = !empty($options['aditionalValue']) ? $options['aditionalValue'] : '';
25 25
     }
26 26
     $optionsHtml .= "<option data-aditionalInput='" . ( count($aditionalInputs) - 1) . "' value ='{$key}'{$selected}>{$value['text']}</option>";
27
-  } else {
27
+    } else {
28 28
     $optionsHtml .= "<option value ='{$key}'{$selected}>{$value}</option>";
29
-  }
29
+    }
30 30
 }
31 31
 ?>
32 32
 <?= empty($options['noContainer']) ? '<div class="form-group">' : ''; ?>
33 33
 <?= $label !== false ? "<label>{$label}" : ''; ?>
34 34
 <?php
35 35
 if ($label !== false && !empty($options['createBtn'])) {
36
-  echo ' (<a href="" onclick="' . $options['createBtn']['onclick'] . ';this.disabled=true;return false;">' . $options['createBtn']['text'] . '</a>)';
36
+    echo ' (<a href="" onclick="' . $options['createBtn']['onclick'] . ';this.disabled=true;return false;">' . $options['createBtn']['text'] . '</a>)';
37 37
 }
38 38
 ?>
39 39
 <?= $label !== false ? "</label>" : ''; ?>
@@ -42,18 +42,18 @@  discard block
 block discarded – undo
42 42
 </select>
43 43
 <?php
44 44
 foreach ($aditionalInputs as $key => $input) {
45
-  $input['options']['noContainer'] = true;
45
+    $input['options']['noContainer'] = true;
46 46
 
47
-  if ($key !== $showedInput) {
47
+    if ($key !== $showedInput) {
48 48
     $input['options']['disabled'] = true;
49 49
     $input['options']['class'] = !empty($input['options']['class']) ? $input['options']['class'] . ' hidden' : 'hidden';
50
-  } else {
50
+    } else {
51 51
     $input['options']['value'] = empty($input['options']['value']) ? $aditionValue : $input['options']['value'];
52
-  }
53
-  if ($input['type'] == 'select') {
52
+    }
53
+    if ($input['type'] == 'select') {
54 54
     $input['options']['values'] = \Ui\ActiveForm::getOptionsList($input);
55
-  }
56
-  $form->input($input['type'], empty($input['name']) ? $name . '[aditional]' : $input['name'], false, $input['options']);
55
+    }
56
+    $form->input($input['type'], empty($input['name']) ? $name . '[aditional]' : $input['name'], false, $input['options']);
57 57
 }
58 58
 ?>
59 59
 <?= empty($options['noContainer']) ? '</div>' : ''; ?>
60 60
\ No newline at end of file
Please login to merge, or discard this patch.
system/modules/Ui/objects/ActiveForm/Input/Select.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 
14 14
 class Select extends \Ui\ActiveForm\Input {
15 15
 
16
-  public function draw() {
16
+    public function draw() {
17 17
     $inputName = $this->colName();
18 18
     $inputLabel = $this->colLabel();
19 19
     $inputParams = $this->colParams;
@@ -25,41 +25,41 @@  discard block
 block discarded – undo
25 25
     ];
26 26
     $modelName = '';
27 27
     switch ($inputParams['source']) {
28
-      case 'model':
28
+        case 'model':
29 29
         $modelName = $inputParams['model'];
30 30
         break;
31
-      case 'relation':
31
+        case 'relation':
32 32
         if ($this->activeForm->modelName) {
33
-          $itemModelName = $this->activeForm->modelName;
34
-          $relation = $itemModelName::getRelation($inputParams['relation']);
35
-          if ($relation['model'] && class_exists($relation['model'])) {
33
+            $itemModelName = $this->activeForm->modelName;
34
+            $relation = $itemModelName::getRelation($inputParams['relation']);
35
+            if ($relation['model'] && class_exists($relation['model'])) {
36 36
             $modelName = $relation['model'];
37
-          }
37
+            }
38 38
         }
39 39
     }
40 40
     if (!empty($modelName)) {
41
-      $inputOptions['createBtn'] = [
42
-          'text' => 'Создать',
43
-          'onclick' => 'inji.Ui.forms.popUp(\'' . addslashes($modelName) . '\',{},function(elem){'
44
-          . 'return function(data,modal){inji.Ui.forms.submitAjax($(elem).closest(\'form\')[0], {notSave: true});}}(this));return false;'
45
-      ];
41
+        $inputOptions['createBtn'] = [
42
+            'text' => 'Создать',
43
+            'onclick' => 'inji.Ui.forms.popUp(\'' . addslashes($modelName) . '\',{},function(elem){'
44
+            . 'return function(data,modal){inji.Ui.forms.submitAjax($(elem).closest(\'form\')[0], {notSave: true});}}(this));return false;'
45
+        ];
46 46
     }
47 47
     if (!empty($inputOptions['values'][$this->activeForm->model->{$this->colName}]) &&
48 48
             is_array($inputOptions['values'][$this->activeForm->model->{$this->colName}]) &&
49 49
             !empty($inputOptions['values'][$this->activeForm->model->{$this->colName}]['input'])) {
50
-      $aditionalCol = $inputOptions['values'][$this->activeForm->model->{$this->colName}]['input']['name'];
51
-      $inputOptions['aditionalValue'] = $this->activeForm->model->$aditionalCol;
50
+        $aditionalCol = $inputOptions['values'][$this->activeForm->model->{$this->colName}]['input']['name'];
51
+        $inputOptions['aditionalValue'] = $this->activeForm->model->$aditionalCol;
52 52
     }
53 53
 
54 54
     $preset = $this->preset();
55 55
 
56 56
     if ($preset !== null) {
57
-      $inputOptions['disabled'] = true;
58
-      $this->form->input('hidden', $inputName, '', $inputOptions);
59
-      return true;
57
+        $inputOptions['disabled'] = true;
58
+        $this->form->input('hidden', $inputName, '', $inputOptions);
59
+        return true;
60 60
     }
61 61
     $this->form->input('select', $inputName, $inputLabel, $inputOptions);
62 62
     return true;
63
-  }
63
+    }
64 64
 
65 65
 }
Please login to merge, or discard this patch.
system/modules/Ui/objects/ActiveForm/Input.php 1 patch
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -13,15 +13,15 @@  discard block
 block discarded – undo
13 13
 
14 14
 class Input extends \Object {
15 15
 
16
-  public $form = null;
17
-  public $activeForm = null;
18
-  public $activeFormParams = [];
19
-  public $modelName = '';
20
-  public $colName = '';
21
-  public $colParams = [];
22
-  public $options = [];
16
+    public $form = null;
17
+    public $activeForm = null;
18
+    public $activeFormParams = [];
19
+    public $modelName = '';
20
+    public $colName = '';
21
+    public $colParams = [];
22
+    public $options = [];
23 23
 
24
-  public function draw() {
24
+    public function draw() {
25 25
     $inputName = $this->colName();
26 26
     $inputLabel = $this->colLabel();
27 27
 
@@ -31,78 +31,78 @@  discard block
 block discarded – undo
31 31
 
32 32
     $preset = $this->preset();
33 33
     if ($preset !== null) {
34
-      $inputOptions['disabled'] = true;
35
-      $this->form->input('hidden', $inputName, '', $inputOptions);
36
-      return true;
34
+        $inputOptions['disabled'] = true;
35
+        $this->form->input('hidden', $inputName, '', $inputOptions);
36
+        return true;
37 37
     }
38 38
     $classPath = explode('\\', get_called_class());
39 39
     $inputType = lcfirst(array_pop($classPath));
40 40
     $this->form->input($inputType, $inputName, $inputLabel, $inputOptions);
41 41
     return true;
42
-  }
42
+    }
43 43
 
44
-  public function parseRequest($request) {
44
+    public function parseRequest($request) {
45 45
     $colName = empty($this->colParams['col']) ? $this->colName : $this->colParams['col'];
46 46
     if (isset($request[$this->colName])) {
47
-      $this->activeForm->model->{$colName} = $request[$this->colName];
47
+        $this->activeForm->model->{$colName} = $request[$this->colName];
48 48
     } else {
49
-      $this->activeForm->model->{$colName} = 0;
50
-      $this->activeForm->model->{$colName} = '';
49
+        $this->activeForm->model->{$colName} = 0;
50
+        $this->activeForm->model->{$colName} = '';
51
+    }
51 52
     }
52
-  }
53 53
 
54
-  public function value() {
54
+    public function value() {
55 55
     $value = isset($this->colParams['default']) ? $this->colParams['default'] : '';
56 56
     if ($this->activeForm) {
57
-      $colName = empty($this->colParams['col']) ? $this->colName : $this->colParams['col'];
58
-      $value = ($this->activeForm && $this->activeForm->model && isset($this->activeForm->model->{$colName})) ? $this->activeForm->model->{$colName} : $value;
57
+        $colName = empty($this->colParams['col']) ? $this->colName : $this->colParams['col'];
58
+        $value = ($this->activeForm && $this->activeForm->model && isset($this->activeForm->model->{$colName})) ? $this->activeForm->model->{$colName} : $value;
59 59
     }
60 60
     return $value;
61
-  }
61
+    }
62 62
 
63
-  public function preset() {
63
+    public function preset() {
64 64
     $preset = !empty($this->activeForm->form['preset'][$this->colName]) ? $this->activeForm->form['preset'][$this->colName] : [];
65 65
     if (!empty($this->activeForm->form['userGroupPreset'][\Users\User::$cur->group_id][$this->colName])) {
66
-      $preset = array_merge($preset, $this->activeForm->form['userGroupPreset'][\Users\User::$cur->group_id][$this->colName]);
66
+        $preset = array_merge($preset, $this->activeForm->form['userGroupPreset'][\Users\User::$cur->group_id][$this->colName]);
67 67
     }
68 68
     if ($preset) {
69
-      $value = '';
70
-      if (!empty($preset['value'])) {
69
+        $value = '';
70
+        if (!empty($preset['value'])) {
71 71
         $value = $preset['value'];
72
-      } elseif (!empty($preset['userCol'])) {
72
+        } elseif (!empty($preset['userCol'])) {
73 73
         if (strpos($preset['userCol'], ':')) {
74
-          $rel = substr($preset['userCol'], 0, strpos($preset['userCol'], ':'));
75
-          $param = substr($preset['userCol'], strpos($preset['userCol'], ':') + 1);
76
-          $value = \Users\User::$cur->$rel->$param;
74
+            $rel = substr($preset['userCol'], 0, strpos($preset['userCol'], ':'));
75
+            $param = substr($preset['userCol'], strpos($preset['userCol'], ':') + 1);
76
+            $value = \Users\User::$cur->$rel->$param;
77 77
         }
78
-      }
79
-      return $value;
78
+        }
79
+        return $value;
80 80
     }
81 81
     return null;
82
-  }
82
+    }
83 83
 
84
-  public function colName() {
84
+    public function colName() {
85 85
     return "{$this->activeForm->requestFormName}[{$this->activeForm->modelName}]".(stristr($this->colName, '[')?$this->colName:"[{$this->colName}]");
86
-  }
86
+    }
87 87
 
88
-  public function colLabel() {
88
+    public function colLabel() {
89 89
     $modelName = $this->modelName;
90 90
     return isset($this->colParams['label']) ? $this->colParams['label'] : (($this->activeForm->model && !empty($modelName::$labels[$this->colName])) ? $modelName::$labels[$this->colName] : $this->colName);
91
-  }
91
+    }
92 92
 
93
-  public function readOnly() {
93
+    public function readOnly() {
94 94
     return !empty($this->activeForm->form['userGroupReadonly'][\Users\User::$cur->group_id]) && in_array($this->colName, $this->activeForm->form['userGroupReadonly'][\Users\User::$cur->group_id]);
95
-  }
95
+    }
96 96
 
97
-  public function validate(&$request) {
97
+    public function validate(&$request) {
98 98
     if (empty($request[$this->colName]) && !empty($this->colParams['required'])) {
99
-      throw new \Exception('Вы не заполнили: ' . $this->colLabel());
99
+        throw new \Exception('Вы не заполнили: ' . $this->colLabel());
100 100
     }
101 101
     if (!empty($this->colParams['validator'])) {
102
-      $modelName = $this->modelName;
103
-      $validator = $modelName::validator($this->colParams['validator']);
104
-      $validator($this->activeForm, $request);
102
+        $modelName = $this->modelName;
103
+        $validator = $modelName::validator($this->colParams['validator']);
104
+        $validator($this->activeForm, $request);
105
+    }
105 106
     }
106
-  }
107 107
 
108 108
 }
Please login to merge, or discard this patch.
system/modules/Ecommerce/appAdminControllers/EcommerceController.php 1 patch
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -10,28 +10,28 @@  discard block
 block discarded – undo
10 10
  */
11 11
 class EcommerceController extends adminController {
12 12
 
13
-  public function dashboardAction() {
13
+    public function dashboardAction() {
14 14
     $this->view->setTitle('Онлайн магазин');
15 15
     $forms = \Ecommerce\Item::$magicForms;
16 16
     \Ecommerce\Item::$forms['simpleItem']['handler']();
17 17
     $this->view->page();
18
-  }
18
+    }
19 19
 
20
-  public function configureAction() {
20
+    public function configureAction() {
21 21
     if (!empty($_POST['config'])) {
22
-      $config = App::$cur->ecommerce->config;
23
-      $config['view_empty_warehouse'] = empty($_POST['config']['view_empty_warehouse']) ? false : true;
24
-      $config['view_empty_image'] = empty($_POST['config']['view_empty_image']) ? false : true;
25
-      $config['sell_empty_warehouse'] = empty($_POST['config']['sell_empty_warehouse']) ? false : true;
26
-      $config['sell_over_warehouse'] = empty($_POST['config']['sell_over_warehouse']) ? false : true;
27
-      $config['notify_mail'] = $_POST['config']['notify_mail'];
28
-      $config['defaultCategoryView'] = $_POST['config']['defaultCategoryView'];
29
-      $config['defaultCurrency'] = $_POST['config']['defaultCurrency'];
30
-      $config['orderPrefix'] = $_POST['config']['orderPrefix'];
31
-      $config['show_zero_price'] = empty($_POST['config']['show_zero_price']) ? false : true;
32
-      $config['show_without_price'] = empty($_POST['config']['show_without_price']) ? false : true;
33
-      Config::save('module', $config, 'Ecommerce');
34
-      Tools::redirect('/admin/ecommerce/configure', 'Настройки были изменены', 'success');
22
+        $config = App::$cur->ecommerce->config;
23
+        $config['view_empty_warehouse'] = empty($_POST['config']['view_empty_warehouse']) ? false : true;
24
+        $config['view_empty_image'] = empty($_POST['config']['view_empty_image']) ? false : true;
25
+        $config['sell_empty_warehouse'] = empty($_POST['config']['sell_empty_warehouse']) ? false : true;
26
+        $config['sell_over_warehouse'] = empty($_POST['config']['sell_over_warehouse']) ? false : true;
27
+        $config['notify_mail'] = $_POST['config']['notify_mail'];
28
+        $config['defaultCategoryView'] = $_POST['config']['defaultCategoryView'];
29
+        $config['defaultCurrency'] = $_POST['config']['defaultCurrency'];
30
+        $config['orderPrefix'] = $_POST['config']['orderPrefix'];
31
+        $config['show_zero_price'] = empty($_POST['config']['show_zero_price']) ? false : true;
32
+        $config['show_without_price'] = empty($_POST['config']['show_without_price']) ? false : true;
33
+        Config::save('module', $config, 'Ecommerce');
34
+        Tools::redirect('/admin/ecommerce/configure', 'Настройки были изменены', 'success');
35 35
     }
36 36
     $managers = [
37 37
         'Ecommerce\Delivery',
@@ -51,51 +51,51 @@  discard block
 block discarded – undo
51 51
     ];
52 52
     $this->view->setTitle('Настройки магазина');
53 53
     $this->view->page(['data' => compact('managers')]);
54
-  }
54
+    }
55 55
 
56
-  public function reBlockIndexAction() {
56
+    public function reBlockIndexAction() {
57 57
     set_time_limit(0);
58 58
     $carts = Cart::getList();
59 59
     foreach ($carts as $cart) {
60
-      $cart->save();
60
+        $cart->save();
61 61
     }
62 62
     Tools::redirect('/admin/ecommerce/configure', 'Данные о блокировках обновлены');
63
-  }
63
+    }
64 64
 
65
-  public function reSearchIndexAction($i = 0) {
65
+    public function reSearchIndexAction($i = 0) {
66 66
     set_time_limit(0);
67 67
     $count = 100;
68 68
     $items = Ecommerce\Item::getList(['start' => $i * $count, 'limit' => $count]);
69 69
     if (!$items) {
70
-      Tools::redirect('/admin/ecommerce/configure', 'Поисковый индекс обновлен');
70
+        Tools::redirect('/admin/ecommerce/configure', 'Поисковый индекс обновлен');
71 71
     } else {
72
-      $i++;
73
-      foreach ($items as $key => $item) {
72
+        $i++;
73
+        foreach ($items as $key => $item) {
74 74
         $item->save();
75 75
         unset($items[$key]);
76 76
         unset($item);
77
-      }
78
-      echo 'Происходит процесс индексации: проиндексировано ' . $i * $count;
79
-      Tools::redirect('/admin/ecommerce/reSearchIndex/' . $i);
77
+        }
78
+        echo 'Происходит процесс индексации: проиндексировано ' . $i * $count;
79
+        Tools::redirect('/admin/ecommerce/reSearchIndex/' . $i);
80
+    }
80 81
     }
81
-  }
82 82
 
83
-  public function newOrdersSubscribeAction() {
83
+    public function newOrdersSubscribeAction() {
84 84
     $this->Notifications->subscribe('Ecommerce-orders');
85
-  }
85
+    }
86 86
 
87
-  public function closeCartAction($cartId = 0) {
87
+    public function closeCartAction($cartId = 0) {
88 88
     $cart = Ecommerce\Cart::get((int) $cartId);
89 89
     $result = new Server\Result();
90 90
     if ($cart && $cart->cart_status_id != 5) {
91
-      $cart->cart_status_id = 5;
92
-      $cart->save();
93
-      $result->successMsg = 'Заказ был завершен';
94
-      $result->send();
91
+        $cart->cart_status_id = 5;
92
+        $cart->save();
93
+        $result->successMsg = 'Заказ был завершен';
94
+        $result->send();
95 95
     }
96 96
     $result->success = false;
97 97
     $result->content = 'Такая корзина не найдена';
98 98
     $result->send();
99
-  }
99
+    }
100 100
 
101 101
 }
Please login to merge, or discard this patch.