@@ -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 |
@@ -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,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,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', |