@@ -20,8 +20,7 @@ |
||
20 | 20 | */ |
21 | 21 | public function configureOptions(OptionsResolver $resolver) |
22 | 22 | { |
23 | - $resolver->setDefaults(array |
|
24 | - ( |
|
23 | + $resolver->setDefaults(array( |
|
25 | 24 | 'widget_config' => array(), |
26 | 25 | 'type_config' => array(), |
27 | 26 | 'dm2_type' => null, |
@@ -28,7 +28,7 @@ |
||
28 | 28 | new type\radiocheckselect, |
29 | 29 | new type\subform, |
30 | 30 | new type\select, |
31 | - new type\tinymce, |
|
31 | + new type\tinymce, |
|
32 | 32 | new type\toolbar, |
33 | 33 | ); |
34 | 34 | } |
@@ -99,8 +99,7 @@ |
||
99 | 99 | |
100 | 100 | public function count($kept = false) |
101 | 101 | { |
102 | - return array |
|
103 | - ( |
|
102 | + return array( |
|
104 | 103 | 'message_receipt' => $this->get_message_receipt_qb($kept)->count_unchecked(), |
105 | 104 | 'link_log' => $this->get_link_log_qb($kept)->count_unchecked(), |
106 | 105 | 'campaign_member' => $this->get_campaign_member_qb($kept)->count_unchecked(), |
@@ -34,8 +34,8 @@ discard block |
||
34 | 34 | } |
35 | 35 | } |
36 | 36 | |
37 | - if ( $input === null |
|
38 | - || ( $input instanceof DateTime |
|
37 | + if ($input === null |
|
38 | + || ($input instanceof DateTime |
|
39 | 39 | && $input->format('Y-m-d H:i:s') == '0001-01-01 00:00:00')) |
40 | 40 | { |
41 | 41 | return $result; |
@@ -61,12 +61,12 @@ discard block |
||
61 | 61 | |
62 | 62 | public function reverseTransform($array) |
63 | 63 | { |
64 | - if (!is_array($array) ) { |
|
64 | + if (!is_array($array)) { |
|
65 | 65 | throw new TransformationFailedException('Expected an array.'); |
66 | 66 | } |
67 | 67 | |
68 | 68 | if (empty($array['date']) |
69 | - || ( $array['date'] instanceof DateTime |
|
69 | + || ($array['date'] instanceof DateTime |
|
70 | 70 | && $array['date']->format('Y-m-d H:i:s') == '0001-01-01 00:00:00')) |
71 | 71 | { |
72 | 72 | return; |
@@ -45,8 +45,7 @@ discard block |
||
45 | 45 | if ($this->config['type_config']['storage_type'] === datetype::UNIXTIME) |
46 | 46 | { |
47 | 47 | $date->setTimestamp($input); |
48 | - } |
|
49 | - else if ($this->config['type_config']['storage_type'] === datetype::ISO) |
|
48 | + } else if ($this->config['type_config']['storage_type'] === datetype::ISO) |
|
50 | 49 | { |
51 | 50 | $date->modify($input); |
52 | 51 | } |
@@ -79,8 +78,7 @@ discard block |
||
79 | 78 | if ($this->config['type_config']['storage_type'] === datetype::UNIXTIME) |
80 | 79 | { |
81 | 80 | return $array['date']->format('U'); |
82 | - } |
|
83 | - else if ($this->config['type_config']['storage_type'] === datetype::ISO) |
|
81 | + } else if ($this->config['type_config']['storage_type'] === datetype::ISO) |
|
84 | 82 | { |
85 | 83 | return $array['date']->format('Y-m-d H:i:s'); |
86 | 84 | } |
@@ -19,7 +19,7 @@ |
||
19 | 19 | |
20 | 20 | public function transform($array) |
21 | 21 | { |
22 | - if (!is_array($array) ) { |
|
22 | + if (!is_array($array)) { |
|
23 | 23 | throw new TransformationFailedException('Expected an array.'); |
24 | 24 | } |
25 | 25 |
@@ -50,8 +50,7 @@ discard block |
||
50 | 50 | { |
51 | 51 | $description = $attachment->get_parameter('midcom.helper.datamanager2.type.blobs', 'description'); |
52 | 52 | } |
53 | - return array |
|
54 | - ( |
|
53 | + return array( |
|
55 | 54 | 'filename' => $attachment->name, |
56 | 55 | 'description' => $description, |
57 | 56 | 'title' => $attachment->title, |
@@ -81,8 +80,7 @@ discard block |
||
81 | 80 | $title = (!empty($data['title'])) ? $data['title'] : $data['file']['name']; |
82 | 81 | $description = (array_key_exists('description', $data)) ? $data['description'] : $title; |
83 | 82 | $stat = stat($data['file']['tmp_name']); |
84 | - return array |
|
85 | - ( |
|
83 | + return array( |
|
86 | 84 | 'filename' => $data['file']['name'], |
87 | 85 | 'description' => $description, |
88 | 86 | 'title' => $title, |
@@ -104,7 +102,7 @@ discard block |
||
104 | 102 | |
105 | 103 | public function reverseTransform($array) |
106 | 104 | { |
107 | - if (!is_array($array) ) { |
|
105 | + if (!is_array($array)) { |
|
108 | 106 | throw new TransformationFailedException('Expected an array.'); |
109 | 107 | } |
110 | 108 |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | |
22 | 22 | public function transform($input) |
23 | 23 | { |
24 | - if ( $this->config['dm2_type'] == 'select' |
|
24 | + if ($this->config['dm2_type'] == 'select' |
|
25 | 25 | && $this->config['type_config']['allow_multiple']) |
26 | 26 | { |
27 | 27 | switch ($this->config['type_config']['multiple_storagemode']) |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | |
44 | 44 | public function reverseTransform($array) |
45 | 45 | { |
46 | - if (!is_array($array) ) { |
|
46 | + if (!is_array($array)) { |
|
47 | 47 | throw new TransformationFailedException('Expected an array.'); |
48 | 48 | } |
49 | 49 | |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | return reset($array['selection']); |
58 | 58 | } |
59 | 59 | |
60 | - if ( $this->config['dm2_type'] == 'select' |
|
60 | + if ($this->config['dm2_type'] == 'select' |
|
61 | 61 | && $this->config['type_config']['allow_multiple']) |
62 | 62 | { |
63 | 63 | switch ($this->config['type_config']['multiple_storagemode']) |
@@ -25,13 +25,11 @@ |
||
25 | 25 | { |
26 | 26 | //This is converting from storage |
27 | 27 | $result[$key] = $this->transform_persistent($value); |
28 | - } |
|
29 | - else if (!empty($value['object'])) |
|
28 | + } else if (!empty($value['object'])) |
|
30 | 29 | { |
31 | 30 | //This is during validation errors |
32 | 31 | $result[$key] = $this->transform_persistent($value['object']); |
33 | - } |
|
34 | - else if ($value !== null) |
|
32 | + } else if ($value !== null) |
|
35 | 33 | { |
36 | 34 | $result[$key] = $this->transform_nonpersistent(array('file' => $value, 'identifier' => 'archival')); |
37 | 35 | } |
@@ -18,8 +18,7 @@ discard block |
||
18 | 18 | */ |
19 | 19 | class schema |
20 | 20 | { |
21 | - private $defaults = array |
|
22 | - ( |
|
21 | + private $defaults = array( |
|
23 | 22 | 'operations' => array('save' => '', 'cancel' => '') |
24 | 23 | ); |
25 | 24 | |
@@ -64,8 +63,7 @@ discard block |
||
64 | 63 | { |
65 | 64 | foreach ($this->config['fields'] as $name => $config) |
66 | 65 | { |
67 | - $options = array |
|
68 | - ( |
|
66 | + $options = array( |
|
69 | 67 | 'label' => $config['title'], |
70 | 68 | 'widget_config' => $config['widget_config'], |
71 | 69 | 'type_config' => $config['type_config'], |
@@ -138,8 +136,7 @@ discard block |
||
138 | 136 | { |
139 | 137 | $resolver = new OptionsResolver(); |
140 | 138 | |
141 | - $resolver->setDefaults(array |
|
142 | - ( |
|
139 | + $resolver->setDefaults(array( |
|
143 | 140 | 'title' => '', |
144 | 141 | 'type' => null, |
145 | 142 | 'type_config' => array(), |
@@ -154,9 +151,9 @@ discard block |
||
154 | 151 | 'end_fieldset' => null |
155 | 152 | )); |
156 | 153 | |
157 | - $normalize_widget = function (Options $options, $value) use ($name) |
|
154 | + $normalize_widget = function(Options $options, $value) use ($name) |
|
158 | 155 | { |
159 | - if ( $value == 'images' |
|
156 | + if ($value == 'images' |
|
160 | 157 | || $value == 'downloads') |
161 | 158 | { |
162 | 159 | return 'subform'; |
@@ -164,10 +161,9 @@ discard block |
||
164 | 161 | return $value; |
165 | 162 | }; |
166 | 163 | |
167 | - $normalize_storage = function (Options $options, $value) use ($name) |
|
164 | + $normalize_storage = function(Options $options, $value) use ($name) |
|
168 | 165 | { |
169 | - $default = array |
|
170 | - ( |
|
166 | + $default = array( |
|
171 | 167 | 'location' => 'parameter', |
172 | 168 | 'domain' => 'midcom.helper.datamanager2', |
173 | 169 | 'name' => $name |
@@ -68,8 +68,7 @@ discard block |
||
68 | 68 | if (array_key_exists($this->_schema, $schemadb)) |
69 | 69 | { |
70 | 70 | $schema_name = $this->_schema; |
71 | - } |
|
72 | - else |
|
71 | + } else |
|
73 | 72 | { |
74 | 73 | $schema_name = key($schemadb); |
75 | 74 | } |
@@ -110,8 +109,7 @@ discard block |
||
110 | 109 | { |
111 | 110 | $this->_rows[] = array($row); |
112 | 111 | } |
113 | - } |
|
114 | - else |
|
112 | + } else |
|
115 | 113 | { |
116 | 114 | $this->_rows = $rows; |
117 | 115 | } |
@@ -48,10 +48,10 @@ |
||
48 | 48 | |
49 | 49 | public function process() |
50 | 50 | { |
51 | - if (!$this->form->isSubmitted()) |
|
52 | - { |
|
53 | - $this->form->handleRequest(); |
|
54 | - } |
|
51 | + if (!$this->form->isSubmitted()) |
|
52 | + { |
|
53 | + $this->form->handleRequest(); |
|
54 | + } |
|
55 | 55 | // we add the stylesheet regardless of processing result, since save does not automatically mean relocate... |
56 | 56 | midcom::get()->head->add_stylesheet(MIDCOM_STATIC_URL . "/midcom.datamanager/default.css"); |
57 | 57 |
@@ -58,7 +58,7 @@ |
||
58 | 58 | if ($this->form->isSubmitted()) |
59 | 59 | { |
60 | 60 | $button = $this->form->getClickedButton(); |
61 | - if ( $button |
|
61 | + if ($button |
|
62 | 62 | && $button->getConfig()->getOption('operation') == self::CANCEL) |
63 | 63 | { |
64 | 64 | return self::CANCEL; |