@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | $connection = \Yii::$app->getDb(); |
16 | 16 | |
17 | 17 | // create the various tables for dds |
18 | - $sql=<<<EOQ |
|
18 | + $sql = <<<EOQ |
|
19 | 19 | -- -------------------------------------------------------- |
20 | 20 | |
21 | 21 | -- |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | $command = $connection->createCommand($sql); |
143 | 143 | $command->execute(); |
144 | 144 | |
145 | - $sql=<<<EOQ |
|
145 | + $sql = <<<EOQ |
|
146 | 146 | -- |
147 | 147 | -- Dumping data for table `dds_storage` |
148 | 148 | -- |
@@ -4,13 +4,13 @@ |
||
4 | 4 | |
5 | 5 | class m161018_154331__dds_add_definition_to_class extends Migration |
6 | 6 | { |
7 | - public function safeUp() |
|
8 | - { |
|
9 | - $this->addColumn('dds_class', 'definition', $this->text(10000) . " DEFAULT NULL COMMENT 'A definition for use by other modules, but not understood by DDS'"); |
|
10 | - } |
|
7 | + public function safeUp() |
|
8 | + { |
|
9 | + $this->addColumn('dds_class', 'definition', $this->text(10000) . " DEFAULT NULL COMMENT 'A definition for use by other modules, but not understood by DDS'"); |
|
10 | + } |
|
11 | 11 | |
12 | - public function safeDown() |
|
13 | - { |
|
14 | - $this->dropColumn('dds_class', 'definition'); |
|
15 | - } |
|
12 | + public function safeDown() |
|
13 | + { |
|
14 | + $this->dropColumn('dds_class', 'definition'); |
|
15 | + } |
|
16 | 16 | } |
@@ -6,7 +6,7 @@ |
||
6 | 6 | { |
7 | 7 | public function safeUp() |
8 | 8 | { |
9 | - $this->addColumn('dds_class', 'definition', $this->text(10000) . " DEFAULT NULL COMMENT 'A definition for use by other modules, but not understood by DDS'"); |
|
9 | + $this->addColumn('dds_class', 'definition', $this->text(10000)." DEFAULT NULL COMMENT 'A definition for use by other modules, but not understood by DDS'"); |
|
10 | 10 | } |
11 | 11 | |
12 | 12 | public function safeDown() |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | * @param string $module which module this is for - e.g. dds or phoebe |
150 | 150 | * @return \neon\daedalus\interfaces\IDdsAppMigrator |
151 | 151 | */ |
152 | - public function getIDdsAppMigrator($module='dds') { |
|
152 | + public function getIDdsAppMigrator($module = 'dds') { |
|
153 | 153 | $factory = $this->get('DdsAppMigratorFactory'); |
154 | 154 | return $factory::createMigrator("@system/$module/migrations"); |
155 | 155 | } |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | /** |
198 | 198 | * @inheritdoc |
199 | 199 | */ |
200 | - public function getDataMap($key, $query='', $filters = [], $fields = [], $start = 0, $length = 100) |
|
200 | + public function getDataMap($key, $query = '', $filters = [], $fields = [], $start = 0, $length = 100) |
|
201 | 201 | { |
202 | 202 | if (is_string($query)) { |
203 | 203 | $filters['_map_field_'] = $query; |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | /** |
210 | 210 | * @inheritdoc |
211 | 211 | */ |
212 | - public function makeMapLookupRequest($key, $ids, $fields=[]) |
|
212 | + public function makeMapLookupRequest($key, $ids, $fields = []) |
|
213 | 213 | { |
214 | 214 | return $this->IDdsObjectMapManagement->makeMapLookupRequest($ids, $fields, $key); |
215 | 215 | } |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | * @param boolean $refresh whther to refresh the cache before fetching this setting defaults to false |
25 | 25 | * @return string |
26 | 26 | */ |
27 | - public function get($app, $key, $default=null, $refresh=false); |
|
27 | + public function get($app, $key, $default = null, $refresh = false); |
|
28 | 28 | |
29 | 29 | /** |
30 | 30 | * Set a setting value |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | * @param boolean $refresh if true forces reftech fo the the settings |
45 | 45 | * @return array in the format @see self::$_settings |
46 | 46 | */ |
47 | - public function getSettings($refresh=false); |
|
47 | + public function getSettings($refresh = false); |
|
48 | 48 | |
49 | 49 | /** |
50 | 50 | * Load the settings from the database and cache for the session |
@@ -52,6 +52,6 @@ discard block |
||
52 | 52 | * @param boolean $refresh if true forces refresh values from the database |
53 | 53 | * @return array in the format @see self::$_settings |
54 | 54 | */ |
55 | - public function getAll($refresh=false); |
|
55 | + public function getAll($refresh = false); |
|
56 | 56 | |
57 | 57 | } |
@@ -15,8 +15,9 @@ |
||
15 | 15 | { |
16 | 16 | $form = new \neon\settings\forms\AppSettings('setting'); |
17 | 17 | $form->registerScripts($this->getView()); |
18 | - if (neon()->request->isAjax) |
|
19 | - return $form->ajaxValidation(); |
|
18 | + if (neon()->request->isAjax) { |
|
19 | + return $form->ajaxValidation(); |
|
20 | + } |
|
20 | 21 | $form->process(); |
21 | 22 | return $this->render('index', [ |
22 | 23 | 'form' => $form, |
@@ -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 | } |
@@ -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 | } |
@@ -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 | } |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | |
7 | 7 | class InstallDatabase extends \yii\base\Model |
8 | 8 | { |
9 | - public $name=''; |
|
9 | + public $name = ''; |
|
10 | 10 | public $username; |
11 | 11 | public $password; |
12 | 12 | public $host = 'localhost'; |
@@ -54,21 +54,21 @@ discard block |
||
54 | 54 | } else { |
55 | 55 | if ($result == InstallHelper::ERROR_DB_UNKNOWN_DATABASE) { |
56 | 56 | // Attempt to create the database (if asked to do so) |
57 | - if ($this->create_database == 1 ) { |
|
58 | - if (! $this->createDatabase($exception)) { |
|
57 | + if ($this->create_database == 1) { |
|
58 | + if (!$this->createDatabase($exception)) { |
|
59 | 59 | $this->error_message = 'cant_create_database'; |
60 | - $this->addError('name', 'Failed to create database "' . $this->name . '" Database error: ' . $exception); |
|
60 | + $this->addError('name', 'Failed to create database "'.$this->name.'" Database error: '.$exception); |
|
61 | 61 | } |
62 | - } else { |
|
62 | + } else { |
|
63 | 63 | // This is useful information - but not an error therefore in |
64 | - if (! $this->isAjaxValidating) { |
|
64 | + if (!$this->isAjaxValidating) { |
|
65 | 65 | $this->error_message = 'unknown_database'; |
66 | - $this->addError('name', 'Unknown database name "' . $this->name . '"'); |
|
66 | + $this->addError('name', 'Unknown database name "'.$this->name.'"'); |
|
67 | 67 | } |
68 | 68 | } |
69 | 69 | } else if ($result == InstallHelper::ERROR_DB_UNKNOWN_HOST) { |
70 | 70 | $this->error_message = 'unknown_host'; |
71 | - $this->addError('host', 'Unknown host name "' . $this->host . '"'); |
|
71 | + $this->addError('host', 'Unknown host name "'.$this->host.'"'); |
|
72 | 72 | } else if ($result == InstallHelper::ERROR_DB_ACCESS_DENIED) { |
73 | 73 | $this->error_message = 'access_denied'; |
74 | 74 | $this->addError('username', 'The username either does not exist or does not work with the given password'); |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | $config['dsn'] = 'mysql:host='.$this->host.';'; |
93 | 93 | $connection = new \neon\core\db\Connection($config); |
94 | 94 | try { |
95 | - $connection->createCommand('CREATE DATABASE ' . $this->name)->execute(); |
|
95 | + $connection->createCommand('CREATE DATABASE '.$this->name)->execute(); |
|
96 | 96 | } catch (\yii\db\Exception $e) { |
97 | 97 | // could not create the database |
98 | 98 | $exception = $e->getMessage(); |
@@ -59,7 +59,7 @@ |
||
59 | 59 | $this->error_message = 'cant_create_database'; |
60 | 60 | $this->addError('name', 'Failed to create database "' . $this->name . '" Database error: ' . $exception); |
61 | 61 | } |
62 | - } else { |
|
62 | + } else { |
|
63 | 63 | // This is useful information - but not an error therefore in |
64 | 64 | if (! $this->isAjaxValidating) { |
65 | 65 | $this->error_message = 'unknown_database'; |