@@ -244,7 +244,7 @@ |
||
244 | 244 | if ($count) |
245 | 245 | $classes = array_merge($classes, $nextSet); |
246 | 246 | $start += $count; |
247 | - } while ($count>0); |
|
247 | + } while ($count > 0); |
|
248 | 248 | $classesByType = array_column($classes, null, 'class_type'); |
249 | 249 | |
250 | 250 | // get the full definition of these |
@@ -101,8 +101,9 @@ discard block |
||
101 | 101 | public function actionEditObject($type, $id) |
102 | 102 | { |
103 | 103 | $form = $this->getPhoebeForm($type); |
104 | - if (neon()->request->getIsAjax()) |
|
105 | - return $form->ajaxValidation(); |
|
104 | + if (neon()->request->getIsAjax()) { |
|
105 | + return $form->ajaxValidation(); |
|
106 | + } |
|
106 | 107 | if ($form->processRequest()) { |
107 | 108 | $this->ddo()->editObject($id, $form->getData()); |
108 | 109 | return $this->redirect(['/daedalus/index/list', 'type'=>$type]); |
@@ -126,8 +127,9 @@ discard block |
||
126 | 127 | public function actionDeleteObject($type, $id, $redirect = true) |
127 | 128 | { |
128 | 129 | $this->ddo()->deleteObject($id); |
129 | - if ($redirect) |
|
130 | - $this->redirect(['/daedalus/index/list', 'type' => $type]); |
|
130 | + if ($redirect) { |
|
131 | + $this->redirect(['/daedalus/index/list', 'type' => $type]); |
|
132 | + } |
|
131 | 133 | } |
132 | 134 | |
133 | 135 | /** |
@@ -139,8 +141,9 @@ discard block |
||
139 | 141 | public function actionUndeleteObject($type, $id, $redirect = true) |
140 | 142 | { |
141 | 143 | $this->ddo()->undeleteObject($id); |
142 | - if ($redirect) |
|
143 | - $this->redirect(['/daedalus/index/list', 'type' => $type]); |
|
144 | + if ($redirect) { |
|
145 | + $this->redirect(['/daedalus/index/list', 'type' => $type]); |
|
146 | + } |
|
144 | 147 | } |
145 | 148 | |
146 | 149 | /** |
@@ -152,8 +155,9 @@ discard block |
||
152 | 155 | public function actionDestroyObject($type, $id, $redirect = true) |
153 | 156 | { |
154 | 157 | $this->ddo()->destroyObject($id); |
155 | - if ($redirect) |
|
156 | - $this->redirect(['/daedalus/index/list', 'type' => $type]); |
|
158 | + if ($redirect) { |
|
159 | + $this->redirect(['/daedalus/index/list', 'type' => $type]); |
|
160 | + } |
|
157 | 161 | } |
158 | 162 | |
159 | 163 | |
@@ -168,8 +172,9 @@ discard block |
||
168 | 172 | while ($rows > 0) { |
169 | 173 | $count = min($rows, 100); |
170 | 174 | $data = []; |
171 | - for ($i = 0; $i < $count; $i++) |
|
172 | - $data[] = $form->fake(); |
|
175 | + for ($i = 0; $i < $count; $i++) { |
|
176 | + $data[] = $form->fake(); |
|
177 | + } |
|
173 | 178 | $this->ddo()->addObjects($type, $data); |
174 | 179 | $rows -= $count; |
175 | 180 | } |
@@ -241,8 +246,9 @@ discard block |
||
241 | 246 | do { |
242 | 247 | $nextSet = $ddc->listClasses(null, $total, false, $start, $length); |
243 | 248 | $count = count($nextSet); |
244 | - if ($count) |
|
245 | - $classes = array_merge($classes, $nextSet); |
|
249 | + if ($count) { |
|
250 | + $classes = array_merge($classes, $nextSet); |
|
251 | + } |
|
246 | 252 | $start += $count; |
247 | 253 | } while ($count>0); |
248 | 254 | $classesByType = array_column($classes, null, 'class_type'); |
@@ -254,8 +260,9 @@ discard block |
||
254 | 260 | foreach ($class['members'] as &$member) { |
255 | 261 | $member['data_type'] = $dataTypeByRef[$member['data_type_ref']]; |
256 | 262 | $member['links_to_table'] = null; |
257 | - if ($member['link_class'] && isset($classesByType[$member['link_class']])) |
|
258 | - $member['links_to_table'] = $classesByType[$member['link_class']]['label']; |
|
263 | + if ($member['link_class'] && isset($classesByType[$member['link_class']])) { |
|
264 | + $member['links_to_table'] = $classesByType[$member['link_class']]['label']; |
|
265 | + } |
|
259 | 266 | } |
260 | 267 | $definitions[$c['class_type']] = $class; |
261 | 268 | } |
@@ -82,8 +82,9 @@ discard block |
||
82 | 82 | */ |
83 | 83 | protected function ddo() |
84 | 84 | { |
85 | - if ($this->_ddo == null) |
|
86 | - $this->_ddo = neon('dds')->IDdsObjectManagement; |
|
85 | + if ($this->_ddo == null) { |
|
86 | + $this->_ddo = neon('dds')->IDdsObjectManagement; |
|
87 | + } |
|
87 | 88 | return $this->_ddo; |
88 | 89 | } |
89 | 90 | |
@@ -92,8 +93,9 @@ discard block |
||
92 | 93 | */ |
93 | 94 | protected function ddc() |
94 | 95 | { |
95 | - if ($this->_ddc == null) |
|
96 | - $this->_ddc = neon('dds')->IDdsClassManagement; |
|
96 | + if ($this->_ddc == null) { |
|
97 | + $this->_ddc = neon('dds')->IDdsClassManagement; |
|
98 | + } |
|
97 | 99 | return $this->_ddc; |
98 | 100 | } |
99 | 101 | |
@@ -102,8 +104,9 @@ discard block |
||
102 | 104 | */ |
103 | 105 | protected function ddt() |
104 | 106 | { |
105 | - if ($this->_ddt == null) |
|
106 | - $this->_ddt = neon('dds')->IDdsDataTypeManagement; |
|
107 | + if ($this->_ddt == null) { |
|
108 | + $this->_ddt = neon('dds')->IDdsDataTypeManagement; |
|
109 | + } |
|
107 | 110 | return $this->_ddt; |
108 | 111 | } |
109 | 112 |
@@ -65,7 +65,7 @@ |
||
65 | 65 | } catch (\Exception $e) { |
66 | 66 | // error occured lets see if it's because the class does not exist |
67 | 67 | if (neon()->getDds()->IDdsClassManagement->getClass($class) === null) { |
68 | - throw new HttpException(404, 'No class exists with name ' . $class); |
|
68 | + throw new HttpException(404, 'No class exists with name '.$class); |
|
69 | 69 | } |
70 | 70 | throw new HttpException(500, $e->getMessage()); |
71 | 71 | } |
@@ -47,15 +47,15 @@ discard block |
||
47 | 47 | * @return array uuid => map field |
48 | 48 | * @throws |
49 | 49 | */ |
50 | - public function actionObjects($class, $filter='', $length=100, $member='', $value='', $start=0) |
|
50 | + public function actionObjects($class, $filter = '', $length = 100, $member = '', $value = '', $start = 0) |
|
51 | 51 | { |
52 | 52 | $mapFilter = []; |
53 | 53 | if (!$class) |
54 | 54 | throw new HttpException(404, "No class name provided"); |
55 | 55 | if ($member && $value) |
56 | - $mapFilter[$member]=$value; |
|
56 | + $mapFilter[$member] = $value; |
|
57 | 57 | if ($filter && is_string($filter)) |
58 | - $mapFilter['_map_field_']=$filter; |
|
58 | + $mapFilter['_map_field_'] = $filter; |
|
59 | 59 | return neon()->getDds()->IDdsObjectManagement->getObjectMap($class, $mapFilter, [], $start, $length); |
60 | 60 | } |
61 | 61 | |
@@ -64,17 +64,17 @@ discard block |
||
64 | 64 | return neon('user')->getDataMapTypes(); |
65 | 65 | } |
66 | 66 | |
67 | - public function actionUsers($filter='') |
|
67 | + public function actionUsers($filter = '') |
|
68 | 68 | { |
69 | 69 | return neon('user')->getDataMap('users', $filter); |
70 | 70 | } |
71 | 71 | |
72 | - public function actionPages($filter='') |
|
72 | + public function actionPages($filter = '') |
|
73 | 73 | { |
74 | 74 | return neon('cms')->getDataMap('pages', $filter); |
75 | 75 | } |
76 | 76 | |
77 | - public function actionPhoebe($type='', $filter='') |
|
77 | + public function actionPhoebe($type = '', $filter = '') |
|
78 | 78 | { |
79 | 79 | $filters = []; |
80 | 80 | if (!$filter) { |
@@ -50,12 +50,15 @@ discard block |
||
50 | 50 | public function actionObjects($class, $filter='', $length=100, $member='', $value='', $start=0) |
51 | 51 | { |
52 | 52 | $mapFilter = []; |
53 | - if (!$class) |
|
54 | - throw new HttpException(404, "No class name provided"); |
|
55 | - if ($member && $value) |
|
56 | - $mapFilter[$member]=$value; |
|
57 | - if ($filter && is_string($filter)) |
|
58 | - $mapFilter['_map_field_']=$filter; |
|
53 | + if (!$class) { |
|
54 | + throw new HttpException(404, "No class name provided"); |
|
55 | + } |
|
56 | + if ($member && $value) { |
|
57 | + $mapFilter[$member]=$value; |
|
58 | + } |
|
59 | + if ($filter && is_string($filter)) { |
|
60 | + $mapFilter['_map_field_']=$filter; |
|
61 | + } |
|
59 | 62 | return neon()->getDds()->IDdsObjectManagement->getObjectMap($class, $mapFilter, [], $start, $length); |
60 | 63 | } |
61 | 64 | |
@@ -83,8 +86,7 @@ discard block |
||
83 | 86 | ['like', 'label', $filter], |
84 | 87 | ['like', 'class_type', $filter] |
85 | 88 | ]; |
86 | - } |
|
87 | - else if ($type === 'phoebe_object') { |
|
89 | + } else if ($type === 'phoebe_object') { |
|
88 | 90 | $filters = ['like', 'uuid', $filter]; |
89 | 91 | } |
90 | 92 | } |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | ]); |
40 | 40 | } |
41 | 41 | |
42 | - public function actionList($type, $uuid=null) |
|
42 | + public function actionList($type, $uuid = null) |
|
43 | 43 | { |
44 | 44 | // sort out where we're going back to |
45 | 45 | $goBackTo = url(['index/list', 'type'=>$type]); |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | $goBackTo = url(['index/list', 'type'=>$type, 'uuid' => $uuid]); |
48 | 48 | |
49 | 49 | // check the class has a change log |
50 | - $class = ['class_type' => $type, 'label'=>ucwords(str_replace('_',' ',$type))]; |
|
50 | + $class = ['class_type' => $type, 'label'=>ucwords(str_replace('_', ' ', $type))]; |
|
51 | 51 | $hasChangeLog = $this->cl->hasChangeLog($type); |
52 | 52 | if (!$hasChangeLog) { |
53 | 53 | return $this->render('list.tpl', [ |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | case 'COMMENT': |
103 | 103 | if (!$uuid) |
104 | 104 | $render['title'] = "Comment added on ".date("d-m-Y \\a\\t H:i:s", strtotime($logEntry['when'])); |
105 | - if (is_array($logEntry['associated_objects']) && count($logEntry['associated_objects'])>0) |
|
105 | + if (is_array($logEntry['associated_objects']) && count($logEntry['associated_objects']) > 0) |
|
106 | 106 | $render['associated_objects'] = implode(', ', $logEntry['associated_objects']); |
107 | 107 | case 'DESTROY': |
108 | 108 | case 'DELETE': |
@@ -43,8 +43,9 @@ discard block |
||
43 | 43 | { |
44 | 44 | // sort out where we're going back to |
45 | 45 | $goBackTo = url(['index/list', 'type'=>$type]); |
46 | - if ($uuid) |
|
47 | - $goBackTo = url(['index/list', 'type'=>$type, 'uuid' => $uuid]); |
|
46 | + if ($uuid) { |
|
47 | + $goBackTo = url(['index/list', 'type'=>$type, 'uuid' => $uuid]); |
|
48 | + } |
|
48 | 49 | |
49 | 50 | // check the class has a change log |
50 | 51 | $class = ['class_type' => $type, 'label'=>ucwords(str_replace('_',' ',$type))]; |
@@ -77,16 +78,18 @@ discard block |
||
77 | 78 | public function actionViewObject($uuid, $logUuid) |
78 | 79 | { |
79 | 80 | $logEntry = $this->cl->getLogEntry($logUuid); |
80 | - if (!$logEntry) |
|
81 | - return 'Log not found'; |
|
81 | + if (!$logEntry) { |
|
82 | + return 'Log not found'; |
|
83 | + } |
|
82 | 84 | $type = $logEntry['class_type']; |
83 | 85 | |
84 | 86 | $class = $this->getClassAsArray($type); |
85 | 87 | $goBackTo = url(['change-log/list', 'type'=>$type, 'uuid' => $uuid]); |
86 | - if ($uuid) |
|
87 | - $headerTitle = "$class[label] [Object '$uuid'] Change Log"; |
|
88 | - else |
|
89 | - $headerTitle = "$class[label] Change Log"; |
|
88 | + if ($uuid) { |
|
89 | + $headerTitle = "$class[label] [Object '$uuid'] Change Log"; |
|
90 | + } else { |
|
91 | + $headerTitle = "$class[label] Change Log"; |
|
92 | + } |
|
90 | 93 | |
91 | 94 | $title = "Status of $uuid on ".date("d-m-Y \\a\\t H:i:s", strtotime($logEntry['when'])); |
92 | 95 | $render = [ |
@@ -100,10 +103,12 @@ discard block |
||
100 | 103 | ]; |
101 | 104 | switch ($logEntry['change_key']) { |
102 | 105 | case 'COMMENT': |
103 | - if (!$uuid) |
|
104 | - $render['title'] = "Comment added on ".date("d-m-Y \\a\\t H:i:s", strtotime($logEntry['when'])); |
|
105 | - if (is_array($logEntry['associated_objects']) && count($logEntry['associated_objects'])>0) |
|
106 | - $render['associated_objects'] = implode(', ', $logEntry['associated_objects']); |
|
106 | + if (!$uuid) { |
|
107 | + $render['title'] = "Comment added on ".date("d-m-Y \\a\\t H:i:s", strtotime($logEntry['when'])); |
|
108 | + } |
|
109 | + if (is_array($logEntry['associated_objects']) && count($logEntry['associated_objects'])>0) { |
|
110 | + $render['associated_objects'] = implode(', ', $logEntry['associated_objects']); |
|
111 | + } |
|
107 | 112 | case 'DESTROY': |
108 | 113 | case 'DELETE': |
109 | 114 | $renderFile = 'viewLogEntry.tpl'; |
@@ -14,7 +14,7 @@ |
||
14 | 14 | |
15 | 15 | public function safeDown() |
16 | 16 | { |
17 | - $this->execute("ALTER TABLE dds_change_log MODIFY `object_uuid` char(22) CHARACTER SET latin1 COLLATE latin1_general_cs NOT NULL COMMENT 'The object that was changed'"); $this->execute("ALTER TABLE dds_change_log DROP COLUMN `before`;"); |
|
17 | + $this->execute("ALTER TABLE dds_change_log MODIFY `object_uuid` char(22) CHARACTER SET latin1 COLLATE latin1_general_cs NOT NULL COMMENT 'The object that was changed'"); $this->execute("ALTER TABLE dds_change_log DROP COLUMN `before`;"); |
|
18 | 18 | $this->execute("ALTER TABLE dds_change_log DROP COLUMN `after`;"); |
19 | 19 | $this->execute("ALTER TABLE dds_change_log ADD `changes` longblob COMMENT 'What the changes were' AFTER `when`;"); |
20 | 20 | } |
@@ -9,8 +9,8 @@ discard block |
||
9 | 9 | */ |
10 | 10 | class m170724_112209_dds_link_table_creation extends Migration |
11 | 11 | { |
12 | - public function safeUp() |
|
13 | - { |
|
12 | + public function safeUp() |
|
13 | + { |
|
14 | 14 | // create a linking table for links |
15 | 15 | $tableOptions = null; |
16 | 16 | if ($this->db->driverName === 'mysql') { |
@@ -40,8 +40,8 @@ discard block |
||
40 | 40 | |
41 | 41 | } |
42 | 42 | |
43 | - public function safeDown() |
|
44 | - { |
|
43 | + public function safeDown() |
|
44 | + { |
|
45 | 45 | $this->dropTable('dds_link'); |
46 | 46 | $connection = neon()->db; |
47 | 47 | $sql =<<<EOQ |
@@ -52,5 +52,5 @@ discard block |
||
52 | 52 | $this->execute($sql); |
53 | 53 | $this->dropColumn('dds_member', 'link_class'); |
54 | 54 | |
55 | - } |
|
55 | + } |
|
56 | 56 | } |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | ], $tableOptions); |
27 | 27 | |
28 | 28 | // create the new link and link datatypes |
29 | - $sql =<<<EOQ |
|
29 | + $sql = <<<EOQ |
|
30 | 30 | SET foreign_key_checks = 0; |
31 | 31 | REPLACE INTO `dds_data_type` (`data_type_ref`, `label`, `description`, `definition`, `storage_ref`, `deleted`) |
32 | 32 | VALUES |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | { |
45 | 45 | $this->dropTable('dds_link'); |
46 | 46 | $connection = neon()->db; |
47 | - $sql =<<<EOQ |
|
47 | + $sql = <<<EOQ |
|
48 | 48 | SET foreign_key_checks=0; |
49 | 49 | DELETE FROM `dds_data_type` WHERE `data_type_ref`='link'; |
50 | 50 | SET foreign_key_checks=1; |
@@ -5,14 +5,14 @@ |
||
5 | 5 | class m161201_170340_dds_add_map_field_to_members extends Migration |
6 | 6 | { |
7 | 7 | |
8 | - public function safeUp() |
|
9 | - { |
|
8 | + public function safeUp() |
|
9 | + { |
|
10 | 10 | $this->addColumn('dds_member', 'map_field', "TINYINT(1) NOT NULL DEFAULT 0 COMMENT 'If true, then this is field data used in defining maps' AFTER `definition`"); |
11 | - } |
|
11 | + } |
|
12 | 12 | |
13 | - public function safeDown() |
|
14 | - { |
|
13 | + public function safeDown() |
|
14 | + { |
|
15 | 15 | $this->dropColumn('dds_member', 'map_field'); |
16 | - } |
|
16 | + } |
|
17 | 17 | |
18 | 18 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | $this->alterColumn('dds_storage', 'type', "enum('INTEGER_TINY','INTEGER_SHORT','INTEGER','INTEGER_LONG','FLOAT','DOUBLE','DATE','DATETIME','TEXT_SHORT','TEXT','TEXT_LONG','BINARY_SHORT','BINARY','BINARY_LONG','CHAR','TIME') COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'the storage type'"); |
12 | 12 | |
13 | - $sql =<<<EOQ |
|
13 | + $sql = <<<EOQ |
|
14 | 14 | SET foreign_key_checks = 0; |
15 | 15 | REPLACE INTO {{%dds_storage}} (`storage_ref`, `label`, `type`, `description`) |
16 | 16 | VALUES |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | $connection->createCommand($sql)->execute(); |
22 | 22 | |
23 | 23 | |
24 | - $sql =<<<EOQ |
|
24 | + $sql = <<<EOQ |
|
25 | 25 | SET foreign_key_checks = 0; |
26 | 26 | REPLACE INTO {{%dds_data_type}} (`data_type_ref`, `label`, `description`, `definition`, `storage_ref`, `deleted`) |
27 | 27 | VALUES |