@@ -35,16 +35,16 @@ discard block |
||
35 | 35 | /** |
36 | 36 | * |
37 | 37 | */ |
38 | - public function process() |
|
39 | - { |
|
40 | - if ($this->shouldProcess()) { |
|
41 | - $this->load(); |
|
42 | - $this->validate(); |
|
43 | - if ($this->hasError()) { |
|
44 | - neon()->session->setFlash('error', 'The form has errors.'); |
|
45 | - } else { |
|
46 | - $this->saveToSettings(); |
|
47 | - neon()->session->setFlash('success', 'Settings have been successfully saved.'); |
|
38 | + public function process() |
|
39 | + { |
|
40 | + if ($this->shouldProcess()) { |
|
41 | + $this->load(); |
|
42 | + $this->validate(); |
|
43 | + if ($this->hasError()) { |
|
44 | + neon()->session->setFlash('error', 'The form has errors.'); |
|
45 | + } else { |
|
46 | + $this->saveToSettings(); |
|
47 | + neon()->session->setFlash('success', 'Settings have been successfully saved.'); |
|
48 | 48 | } |
49 | 49 | } else { |
50 | 50 | $this->loadFieldValuesFromSettings(); |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | foreach ($appSettings as $key => $value) { |
67 | 67 | // if the fields value is valid then save it |
68 | 68 | if ($appForm->getField($key)->validate()) { |
69 | - $saved = $this->getSettingsManager()->set($appKey, $key, $value); |
|
69 | + $saved = $this->getSettingsManager()->set($appKey, $key, $value); |
|
70 | 70 | } |
71 | 71 | } |
72 | 72 | } |
@@ -81,7 +81,7 @@ |
||
81 | 81 | public function loadFields() |
82 | 82 | { |
83 | 83 | $settings = neon()->settings->getAppSettings(); |
84 | - foreach($settings as $app => $config) { |
|
84 | + foreach ($settings as $app => $config) { |
|
85 | 85 | if (is_array($config)) { |
86 | 86 | $this->addSubForm($app)->setFields($config)->setLabel(neon($app)->name); |
87 | 87 | } |
@@ -15,8 +15,9 @@ |
||
15 | 15 | $success = true; |
16 | 16 | foreach ($settings as $setting) { |
17 | 17 | try { |
18 | - if ($setting->value != null) |
|
19 | - $setting->value = $this->_decode($setting->value); |
|
18 | + if ($setting->value != null) { |
|
19 | + $setting->value = $this->_decode($setting->value); |
|
20 | + } |
|
20 | 21 | } catch (\Exception $e) { |
21 | 22 | dp("Error while decoding setting from json: {$setting->app} {$setting->key} {$setting->value}. Error is ".$e->getMessage()); |
22 | 23 | dp('Trying to save it back as Json'); |
@@ -22,8 +22,8 @@ |
||
22 | 22 | |
23 | 23 | /** |
24 | 24 | * Get all registered settings for each neon app |
25 | - * ??? This should be in the settings manager ??? |
|
26 | - * |
|
25 | + * ??? This should be in the settings manager ??? |
|
26 | + * |
|
27 | 27 | * @return array |
28 | 28 | */ |
29 | 29 | public function getAppSettings() |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | public function getAppSettings() |
30 | 30 | { |
31 | 31 | $ret = []; |
32 | - foreach(neon()->getActiveApps() as $key => $app) { |
|
32 | + foreach (neon()->getActiveApps() as $key => $app) { |
|
33 | 33 | if (!empty($app->getSettings())) { |
34 | 34 | $ret[$key] = $app->getSettings(); |
35 | 35 | } |
@@ -185,16 +185,16 @@ discard block |
||
185 | 185 | |
186 | 186 | private function _itemLineDatetime($dateFormat, $exampleDate) |
187 | 187 | { |
188 | - return neon()->formatter->asDatetime($exampleDate, $dateFormat) . " - $dateFormat"; |
|
188 | + return neon()->formatter->asDatetime($exampleDate, $dateFormat)." - $dateFormat"; |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | private function _itemLine($dateFormat, $exampleDate) |
192 | 192 | { |
193 | - return neon()->formatter->asDate($exampleDate, $dateFormat) . " - $dateFormat"; |
|
193 | + return neon()->formatter->asDate($exampleDate, $dateFormat)." - $dateFormat"; |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | private function _itemLineTime($dateFormat, $exampleDate) |
197 | 197 | { |
198 | - return neon()->formatter->asTime($exampleDate, $dateFormat) . " - $dateFormat"; |
|
198 | + return neon()->formatter->asTime($exampleDate, $dateFormat)." - $dateFormat"; |
|
199 | 199 | } |
200 | 200 | } |
@@ -35,7 +35,7 @@ |
||
35 | 35 | /** |
36 | 36 | * @inheritdoc |
37 | 37 | */ |
38 | - public function processAsFilter(IQuery $query, $searchData=null) |
|
38 | + public function processAsFilter(IQuery $query, $searchData = null) |
|
39 | 39 | { |
40 | 40 | $searchData = ($searchData === null) ? $this->getValue() : $searchData; |
41 | 41 | if (!empty($searchData)) { |
@@ -35,7 +35,7 @@ |
||
35 | 35 | /** |
36 | 36 | * @inheritdoc |
37 | 37 | */ |
38 | - public function processAsFilter(IQuery $query, $searchData=null) |
|
38 | + public function processAsFilter(IQuery $query, $searchData = null) |
|
39 | 39 | { |
40 | 40 | $searchData = ($searchData === null) ? $this->getValue() : $searchData; |
41 | 41 | if (!empty($searchData)) { |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | // $connection->createCommand($sql)->execute(); |
26 | 26 | |
27 | 27 | // 1. add the choices datatype |
28 | -$sql =<<<EOQ |
|
28 | +$sql = <<<EOQ |
|
29 | 29 | SET foreign_key_checks = 0; |
30 | 30 | REPLACE INTO `dds_data_type` (`data_type_ref`, `label`, `description`, `definition`, `storage_ref`, `deleted`) |
31 | 31 | VALUES |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | { |
47 | 47 | $connection = neon()->db; |
48 | 48 | |
49 | -$sql =<<<EOQ |
|
49 | +$sql = <<<EOQ |
|
50 | 50 | SET foreign_key_checks = 0; |
51 | 51 | DELETE FROM {{%dds_data_type}} WHERE `data_type_ref`='choice' LIMIT 1; |
52 | 52 | SET foreign_key_checks = 1; |
@@ -4,9 +4,9 @@ discard block |
||
4 | 4 | |
5 | 5 | class m160913_121403__neon_dds_changes extends Migration |
6 | 6 | { |
7 | - // Use safeUp/safeDown to run migration code within a transaction |
|
8 | - public function safeUp() |
|
9 | - { |
|
7 | + // Use safeUp/safeDown to run migration code within a transaction |
|
8 | + public function safeUp() |
|
9 | + { |
|
10 | 10 | // add a series of default types to the datatypes |
11 | 11 | $sql =<<<EOQ |
12 | 12 | INSERT INTO `dds_data_type` (`data_type_ref`, `label`, `description`, `definition`, `storage_ref`, `deleted`) |
@@ -40,10 +40,10 @@ discard block |
||
40 | 40 | $command = $connection->createCommand($sql); |
41 | 41 | $command->execute(); |
42 | 42 | |
43 | - } |
|
43 | + } |
|
44 | 44 | |
45 | - public function safeDown() |
|
46 | - { |
|
45 | + public function safeDown() |
|
46 | + { |
|
47 | 47 | // delete the additional rows in the datatypes |
48 | 48 | $sql =<<<EOQ |
49 | 49 | DELETE FROM `dds_data_type` WHERE `data_type_ref` IN |
@@ -55,5 +55,5 @@ discard block |
||
55 | 55 | $command = $connection->createCommand($sql); |
56 | 56 | $command->execute(); |
57 | 57 | |
58 | - } |
|
58 | + } |
|
59 | 59 | } |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | public function safeUp() |
9 | 9 | { |
10 | 10 | // add a series of default types to the datatypes |
11 | - $sql =<<<EOQ |
|
11 | + $sql = <<<EOQ |
|
12 | 12 | INSERT INTO `dds_data_type` (`data_type_ref`, `label`, `description`, `definition`, `storage_ref`, `deleted`) |
13 | 13 | VALUES |
14 | 14 | ('binary','Normal Binary','For normal binaries such as images up to 16MB in size','','binary',0), |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | public function safeDown() |
46 | 46 | { |
47 | 47 | // delete the additional rows in the datatypes |
48 | - $sql =<<<EOQ |
|
48 | + $sql = <<<EOQ |
|
49 | 49 | DELETE FROM `dds_data_type` WHERE `data_type_ref` IN |
50 | 50 | ('binary', 'binarylong', 'binaryshort', 'date', 'datetime', 'float', 'floatdouble', |
51 | 51 | 'integer', 'integerlong', 'integershort', 'integertiny', 'text', 'textlong', 'textshort', |
@@ -4,26 +4,26 @@ |
||
4 | 4 | |
5 | 5 | class m170904_201142_dds_multichoice_creation extends Migration |
6 | 6 | { |
7 | - public function safeUp() |
|
8 | - { |
|
9 | - $sql =<<<EOQ |
|
7 | + public function safeUp() |
|
8 | + { |
|
9 | + $sql =<<<EOQ |
|
10 | 10 | SET foreign_key_checks = 0; |
11 | 11 | REPLACE INTO `dds_data_type` (`data_type_ref`, `label`, `description`, `definition`, `storage_ref`, `deleted`) |
12 | 12 | VALUES |
13 | 13 | ('choice_multiple','Multiple Choice','For storing multiple choice keys','{"size":10000}','text',0); |
14 | 14 | SET foreign_key_checks = 1; |
15 | 15 | EOQ; |
16 | - $this->execute($sql); |
|
16 | + $this->execute($sql); |
|
17 | 17 | |
18 | - } |
|
18 | + } |
|
19 | 19 | |
20 | - public function safeDown() |
|
21 | - { |
|
22 | - $sql =<<<EOQ |
|
20 | + public function safeDown() |
|
21 | + { |
|
22 | + $sql =<<<EOQ |
|
23 | 23 | SET foreign_key_checks=0; |
24 | 24 | DELETE FROM `dds_data_type` WHERE `data_type_ref`='choice_multiple'; |
25 | 25 | SET foreign_key_checks=1; |
26 | 26 | EOQ; |
27 | - $this->execute($sql); |
|
28 | - } |
|
27 | + $this->execute($sql); |
|
28 | + } |
|
29 | 29 | } |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | { |
7 | 7 | public function safeUp() |
8 | 8 | { |
9 | - $sql =<<<EOQ |
|
9 | + $sql = <<<EOQ |
|
10 | 10 | SET foreign_key_checks = 0; |
11 | 11 | REPLACE INTO `dds_data_type` (`data_type_ref`, `label`, `description`, `definition`, `storage_ref`, `deleted`) |
12 | 12 | VALUES |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | |
20 | 20 | public function safeDown() |
21 | 21 | { |
22 | - $sql =<<<EOQ |
|
22 | + $sql = <<<EOQ |
|
23 | 23 | SET foreign_key_checks=0; |
24 | 24 | DELETE FROM `dds_data_type` WHERE `data_type_ref`='choice_multiple'; |
25 | 25 | SET foreign_key_checks=1; |
@@ -4,8 +4,8 @@ discard block |
||
4 | 4 | |
5 | 5 | class m161111_161448__dds_removal_of_ids extends Migration |
6 | 6 | { |
7 | - public function safeUp() |
|
8 | - { |
|
7 | + public function safeUp() |
|
8 | + { |
|
9 | 9 | // delete ids |
10 | 10 | $this->dropColumn('dds_class', 'id'); |
11 | 11 | $this->dropColumn('dds_data_type', 'id'); |
@@ -14,10 +14,10 @@ discard block |
||
14 | 14 | |
15 | 15 | // add a uuid to object tables |
16 | 16 | $this->execute('ALTER TABLE `dds_object` ADD `_uuid` CHAR(36) NOT NULL FIRST, ADD PRIMARY KEY (`_uuid`)'); |
17 | - } |
|
17 | + } |
|
18 | 18 | |
19 | - public function safeDown() |
|
20 | - { |
|
19 | + public function safeDown() |
|
20 | + { |
|
21 | 21 | // remove the uuid |
22 | 22 | $this->dropColumn('dds_object', '_uuid'); |
23 | 23 | // add ids back again |
@@ -25,5 +25,5 @@ discard block |
||
25 | 25 | $this->execute('ALTER TABLE `dds_data_type` ADD `id` INT UNSIGNED NOT NULL AUTO_INCREMENT FIRST, ADD PRIMARY KEY (`id`)'); |
26 | 26 | $this->execute('ALTER TABLE `dds_member` ADD `id` INT UNSIGNED NOT NULL AUTO_INCREMENT FIRST, ADD PRIMARY KEY (`id`)'); |
27 | 27 | $this->execute('ALTER TABLE `dds_object` ADD `_id` INT UNSIGNED NOT NULL AUTO_INCREMENT FIRST, ADD PRIMARY KEY (`_id`)'); |
28 | - } |
|
28 | + } |
|
29 | 29 | } |