@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | |
17 | 17 | function resources_upgrade0_0_1_008() |
18 | 18 | { |
19 | - $GLOBALS['phpgw_setup']->oProc->AddColumn('egw_resources','picture_src',array( |
|
19 | + $GLOBALS['phpgw_setup']->oProc->AddColumn('egw_resources', 'picture_src', array( |
|
20 | 20 | 'type' => 'varchar', |
21 | 21 | 'precision' => '20' |
22 | 22 | )); |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | |
29 | 29 | function resources_upgrade0_0_1_012() |
30 | 30 | { |
31 | - $GLOBALS['phpgw_setup']->oProc->AddColumn('egw_resources','picture_thumb',array( |
|
31 | + $GLOBALS['phpgw_setup']->oProc->AddColumn('egw_resources', 'picture_thumb', array( |
|
32 | 32 | 'type' => 'blob' |
33 | 33 | )); |
34 | 34 | |
@@ -39,49 +39,49 @@ discard block |
||
39 | 39 | |
40 | 40 | function resources_upgrade0_0_1_013() |
41 | 41 | { |
42 | - $GLOBALS['phpgw_setup']->oProc->DropColumn('egw_resources',array( |
|
42 | + $GLOBALS['phpgw_setup']->oProc->DropColumn('egw_resources', array( |
|
43 | 43 | 'fd' => array( |
44 | 44 | 'id' => array('type' => 'auto'), |
45 | - 'name' => array('type' => 'varchar','precision' => '100'), |
|
46 | - 'short_description' => array('type' => 'varchar','precision' => '100'), |
|
47 | - 'cat_id' => array('type' => 'int','precision' => '11','nullable' => False), |
|
48 | - 'quantity' => array('type' => 'int','precision' => '11'), |
|
49 | - 'useable' => array('type' => 'int','precision' => '11'), |
|
50 | - 'location' => array('type' => 'varchar','precision' => '100'), |
|
51 | - 'bookable' => array('type' => 'varchar','precision' => '1'), |
|
52 | - 'buyable' => array('type' => 'varchar','precision' => '1'), |
|
53 | - 'prize' => array('type' => 'varchar','precision' => '200'), |
|
45 | + 'name' => array('type' => 'varchar', 'precision' => '100'), |
|
46 | + 'short_description' => array('type' => 'varchar', 'precision' => '100'), |
|
47 | + 'cat_id' => array('type' => 'int', 'precision' => '11', 'nullable' => False), |
|
48 | + 'quantity' => array('type' => 'int', 'precision' => '11'), |
|
49 | + 'useable' => array('type' => 'int', 'precision' => '11'), |
|
50 | + 'location' => array('type' => 'varchar', 'precision' => '100'), |
|
51 | + 'bookable' => array('type' => 'varchar', 'precision' => '1'), |
|
52 | + 'buyable' => array('type' => 'varchar', 'precision' => '1'), |
|
53 | + 'prize' => array('type' => 'varchar', 'precision' => '200'), |
|
54 | 54 | 'long_description' => array('type' => 'longtext'), |
55 | - 'accessories' => array('type' => 'varchar','precision' => '50'), |
|
56 | - 'picture_src' => array('type' => 'varchar','precision' => '20'), |
|
55 | + 'accessories' => array('type' => 'varchar', 'precision' => '50'), |
|
56 | + 'picture_src' => array('type' => 'varchar', 'precision' => '20'), |
|
57 | 57 | 'picture_thumb' => array('type' => 'blob') |
58 | 58 | ), |
59 | 59 | 'pk' => array('id'), |
60 | 60 | 'fk' => array(), |
61 | 61 | 'ix' => array(), |
62 | 62 | 'uc' => array() |
63 | - ),'picture'); |
|
64 | - $GLOBALS['phpgw_setup']->oProc->DropColumn('egw_resources',array( |
|
63 | + ), 'picture'); |
|
64 | + $GLOBALS['phpgw_setup']->oProc->DropColumn('egw_resources', array( |
|
65 | 65 | 'fd' => array( |
66 | 66 | 'id' => array('type' => 'auto'), |
67 | - 'name' => array('type' => 'varchar','precision' => '100'), |
|
68 | - 'short_description' => array('type' => 'varchar','precision' => '100'), |
|
69 | - 'cat_id' => array('type' => 'int','precision' => '11','nullable' => False), |
|
70 | - 'quantity' => array('type' => 'int','precision' => '11'), |
|
71 | - 'useable' => array('type' => 'int','precision' => '11'), |
|
72 | - 'location' => array('type' => 'varchar','precision' => '100'), |
|
73 | - 'bookable' => array('type' => 'varchar','precision' => '1'), |
|
74 | - 'buyable' => array('type' => 'varchar','precision' => '1'), |
|
75 | - 'prize' => array('type' => 'varchar','precision' => '200'), |
|
67 | + 'name' => array('type' => 'varchar', 'precision' => '100'), |
|
68 | + 'short_description' => array('type' => 'varchar', 'precision' => '100'), |
|
69 | + 'cat_id' => array('type' => 'int', 'precision' => '11', 'nullable' => False), |
|
70 | + 'quantity' => array('type' => 'int', 'precision' => '11'), |
|
71 | + 'useable' => array('type' => 'int', 'precision' => '11'), |
|
72 | + 'location' => array('type' => 'varchar', 'precision' => '100'), |
|
73 | + 'bookable' => array('type' => 'varchar', 'precision' => '1'), |
|
74 | + 'buyable' => array('type' => 'varchar', 'precision' => '1'), |
|
75 | + 'prize' => array('type' => 'varchar', 'precision' => '200'), |
|
76 | 76 | 'long_description' => array('type' => 'longtext'), |
77 | - 'accessories' => array('type' => 'varchar','precision' => '50'), |
|
78 | - 'picture_src' => array('type' => 'varchar','precision' => '20') |
|
77 | + 'accessories' => array('type' => 'varchar', 'precision' => '50'), |
|
78 | + 'picture_src' => array('type' => 'varchar', 'precision' => '20') |
|
79 | 79 | ), |
80 | 80 | 'pk' => array('id'), |
81 | 81 | 'fk' => array(), |
82 | 82 | 'ix' => array(), |
83 | 83 | 'uc' => array() |
84 | - ),'picture_thumb'); |
|
84 | + ), 'picture_thumb'); |
|
85 | 85 | |
86 | 86 | $GLOBALS['setup_info']['resources']['currentver'] = '0.0.1.014'; |
87 | 87 | return $GLOBALS['setup_info']['resources']['currentver']; |
@@ -90,12 +90,12 @@ discard block |
||
90 | 90 | |
91 | 91 | function resources_upgrade0_0_1_014() |
92 | 92 | { |
93 | - $GLOBALS['phpgw_setup']->oProc->AlterColumn('egw_resources','quantity',array( |
|
93 | + $GLOBALS['phpgw_setup']->oProc->AlterColumn('egw_resources', 'quantity', array( |
|
94 | 94 | 'type' => 'int', |
95 | 95 | 'precision' => '11', |
96 | 96 | 'default' => '1' |
97 | 97 | )); |
98 | - $GLOBALS['phpgw_setup']->oProc->AlterColumn('egw_resources','useable',array( |
|
98 | + $GLOBALS['phpgw_setup']->oProc->AlterColumn('egw_resources', 'useable', array( |
|
99 | 99 | 'type' => 'int', |
100 | 100 | 'precision' => '11', |
101 | 101 | 'default' => '1' |
@@ -108,16 +108,16 @@ discard block |
||
108 | 108 | |
109 | 109 | function resources_upgrade0_0_1_015() |
110 | 110 | { |
111 | - $GLOBALS['phpgw_setup']->oProc->AlterColumn('egw_resources','accessories',array( |
|
111 | + $GLOBALS['phpgw_setup']->oProc->AlterColumn('egw_resources', 'accessories', array( |
|
112 | 112 | 'type' => 'varchar', |
113 | 113 | 'precision' => '100' |
114 | 114 | )); |
115 | - $GLOBALS['phpgw_setup']->oProc->AddColumn('egw_resources','accessory_only',array( |
|
115 | + $GLOBALS['phpgw_setup']->oProc->AddColumn('egw_resources', 'accessory_only', array( |
|
116 | 116 | 'type' => 'varchar', |
117 | 117 | 'precision' => '1', |
118 | 118 | 'default' => '0' |
119 | 119 | )); |
120 | - $GLOBALS['phpgw_setup']->oProc->AddColumn('egw_resources','relatives',array( |
|
120 | + $GLOBALS['phpgw_setup']->oProc->AddColumn('egw_resources', 'relatives', array( |
|
121 | 121 | 'type' => 'varchar', |
122 | 122 | 'precision' => '100' |
123 | 123 | )); |
@@ -129,70 +129,70 @@ discard block |
||
129 | 129 | |
130 | 130 | function resources_upgrade0_0_1_016() |
131 | 131 | { |
132 | - $GLOBALS['phpgw_setup']->oProc->DropColumn('egw_resources',array( |
|
132 | + $GLOBALS['phpgw_setup']->oProc->DropColumn('egw_resources', array( |
|
133 | 133 | 'fd' => array( |
134 | 134 | 'id' => array('type' => 'auto'), |
135 | - 'name' => array('type' => 'varchar','precision' => '100'), |
|
136 | - 'short_description' => array('type' => 'varchar','precision' => '100'), |
|
137 | - 'cat_id' => array('type' => 'int','precision' => '11','nullable' => False), |
|
138 | - 'quantity' => array('type' => 'int','precision' => '11','default' => '1'), |
|
139 | - 'useable' => array('type' => 'int','precision' => '11','default' => '1'), |
|
140 | - 'location' => array('type' => 'varchar','precision' => '100'), |
|
141 | - 'bookable' => array('type' => 'varchar','precision' => '1'), |
|
142 | - 'buyable' => array('type' => 'varchar','precision' => '1'), |
|
143 | - 'prize' => array('type' => 'varchar','precision' => '200'), |
|
135 | + 'name' => array('type' => 'varchar', 'precision' => '100'), |
|
136 | + 'short_description' => array('type' => 'varchar', 'precision' => '100'), |
|
137 | + 'cat_id' => array('type' => 'int', 'precision' => '11', 'nullable' => False), |
|
138 | + 'quantity' => array('type' => 'int', 'precision' => '11', 'default' => '1'), |
|
139 | + 'useable' => array('type' => 'int', 'precision' => '11', 'default' => '1'), |
|
140 | + 'location' => array('type' => 'varchar', 'precision' => '100'), |
|
141 | + 'bookable' => array('type' => 'varchar', 'precision' => '1'), |
|
142 | + 'buyable' => array('type' => 'varchar', 'precision' => '1'), |
|
143 | + 'prize' => array('type' => 'varchar', 'precision' => '200'), |
|
144 | 144 | 'long_description' => array('type' => 'longtext'), |
145 | - 'accessories' => array('type' => 'varchar','precision' => '100'), |
|
146 | - 'picture_src' => array('type' => 'varchar','precision' => '20'), |
|
147 | - 'relatives' => array('type' => 'varchar','precision' => '100') |
|
145 | + 'accessories' => array('type' => 'varchar', 'precision' => '100'), |
|
146 | + 'picture_src' => array('type' => 'varchar', 'precision' => '20'), |
|
147 | + 'relatives' => array('type' => 'varchar', 'precision' => '100') |
|
148 | 148 | ), |
149 | 149 | 'pk' => array('id'), |
150 | 150 | 'fk' => array(), |
151 | 151 | 'ix' => array(), |
152 | 152 | 'uc' => array() |
153 | - ),'accessory_only'); |
|
154 | - $GLOBALS['phpgw_setup']->oProc->DropColumn('egw_resources',array( |
|
153 | + ), 'accessory_only'); |
|
154 | + $GLOBALS['phpgw_setup']->oProc->DropColumn('egw_resources', array( |
|
155 | 155 | 'fd' => array( |
156 | 156 | 'id' => array('type' => 'auto'), |
157 | - 'name' => array('type' => 'varchar','precision' => '100'), |
|
158 | - 'short_description' => array('type' => 'varchar','precision' => '100'), |
|
159 | - 'cat_id' => array('type' => 'int','precision' => '11','nullable' => False), |
|
160 | - 'quantity' => array('type' => 'int','precision' => '11','default' => '1'), |
|
161 | - 'useable' => array('type' => 'int','precision' => '11','default' => '1'), |
|
162 | - 'location' => array('type' => 'varchar','precision' => '100'), |
|
163 | - 'bookable' => array('type' => 'varchar','precision' => '1'), |
|
164 | - 'buyable' => array('type' => 'varchar','precision' => '1'), |
|
165 | - 'prize' => array('type' => 'varchar','precision' => '200'), |
|
157 | + 'name' => array('type' => 'varchar', 'precision' => '100'), |
|
158 | + 'short_description' => array('type' => 'varchar', 'precision' => '100'), |
|
159 | + 'cat_id' => array('type' => 'int', 'precision' => '11', 'nullable' => False), |
|
160 | + 'quantity' => array('type' => 'int', 'precision' => '11', 'default' => '1'), |
|
161 | + 'useable' => array('type' => 'int', 'precision' => '11', 'default' => '1'), |
|
162 | + 'location' => array('type' => 'varchar', 'precision' => '100'), |
|
163 | + 'bookable' => array('type' => 'varchar', 'precision' => '1'), |
|
164 | + 'buyable' => array('type' => 'varchar', 'precision' => '1'), |
|
165 | + 'prize' => array('type' => 'varchar', 'precision' => '200'), |
|
166 | 166 | 'long_description' => array('type' => 'longtext'), |
167 | - 'accessories' => array('type' => 'varchar','precision' => '100'), |
|
168 | - 'picture_src' => array('type' => 'varchar','precision' => '20') |
|
167 | + 'accessories' => array('type' => 'varchar', 'precision' => '100'), |
|
168 | + 'picture_src' => array('type' => 'varchar', 'precision' => '20') |
|
169 | 169 | ), |
170 | 170 | 'pk' => array('id'), |
171 | 171 | 'fk' => array(), |
172 | 172 | 'ix' => array(), |
173 | 173 | 'uc' => array() |
174 | - ),'relatives'); |
|
175 | - $GLOBALS['phpgw_setup']->oProc->DropColumn('egw_resources',array( |
|
174 | + ), 'relatives'); |
|
175 | + $GLOBALS['phpgw_setup']->oProc->DropColumn('egw_resources', array( |
|
176 | 176 | 'fd' => array( |
177 | 177 | 'id' => array('type' => 'auto'), |
178 | - 'name' => array('type' => 'varchar','precision' => '100'), |
|
179 | - 'short_description' => array('type' => 'varchar','precision' => '100'), |
|
180 | - 'cat_id' => array('type' => 'int','precision' => '11','nullable' => False), |
|
181 | - 'quantity' => array('type' => 'int','precision' => '11','default' => '1'), |
|
182 | - 'useable' => array('type' => 'int','precision' => '11','default' => '1'), |
|
183 | - 'location' => array('type' => 'varchar','precision' => '100'), |
|
184 | - 'bookable' => array('type' => 'varchar','precision' => '1'), |
|
185 | - 'buyable' => array('type' => 'varchar','precision' => '1'), |
|
186 | - 'prize' => array('type' => 'varchar','precision' => '200'), |
|
178 | + 'name' => array('type' => 'varchar', 'precision' => '100'), |
|
179 | + 'short_description' => array('type' => 'varchar', 'precision' => '100'), |
|
180 | + 'cat_id' => array('type' => 'int', 'precision' => '11', 'nullable' => False), |
|
181 | + 'quantity' => array('type' => 'int', 'precision' => '11', 'default' => '1'), |
|
182 | + 'useable' => array('type' => 'int', 'precision' => '11', 'default' => '1'), |
|
183 | + 'location' => array('type' => 'varchar', 'precision' => '100'), |
|
184 | + 'bookable' => array('type' => 'varchar', 'precision' => '1'), |
|
185 | + 'buyable' => array('type' => 'varchar', 'precision' => '1'), |
|
186 | + 'prize' => array('type' => 'varchar', 'precision' => '200'), |
|
187 | 187 | 'long_description' => array('type' => 'longtext'), |
188 | - 'picture_src' => array('type' => 'varchar','precision' => '20') |
|
188 | + 'picture_src' => array('type' => 'varchar', 'precision' => '20') |
|
189 | 189 | ), |
190 | 190 | 'pk' => array('id'), |
191 | 191 | 'fk' => array(), |
192 | 192 | 'ix' => array(), |
193 | 193 | 'uc' => array() |
194 | - ),'accessories'); |
|
195 | - $GLOBALS['phpgw_setup']->oProc->AddColumn('egw_resources','accessory_of',array( |
|
194 | + ), 'accessories'); |
|
195 | + $GLOBALS['phpgw_setup']->oProc->AddColumn('egw_resources', 'accessory_of', array( |
|
196 | 196 | 'type' => 'int', |
197 | 197 | 'precision' => '11', |
198 | 198 | 'default' => '-1' |
@@ -204,22 +204,22 @@ discard block |
||
204 | 204 | |
205 | 205 | function resources_upgrade0_0_1_017() |
206 | 206 | { |
207 | - $GLOBALS['phpgw_setup']->oProc->RenameColumn('egw_resources','id','res_id'); |
|
208 | - $GLOBALS['phpgw_setup']->oProc->RefreshTable('egw_resources',array( |
|
207 | + $GLOBALS['phpgw_setup']->oProc->RenameColumn('egw_resources', 'id', 'res_id'); |
|
208 | + $GLOBALS['phpgw_setup']->oProc->RefreshTable('egw_resources', array( |
|
209 | 209 | 'fd' => array( |
210 | 210 | 'res_id' => array('type' => 'auto'), |
211 | - 'name' => array('type' => 'varchar','precision' => '100'), |
|
212 | - 'short_description' => array('type' => 'varchar','precision' => '100'), |
|
213 | - 'cat_id' => array('type' => 'int','precision' => '11','nullable' => False), |
|
214 | - 'quantity' => array('type' => 'int','precision' => '11','default' => '1'), |
|
215 | - 'useable' => array('type' => 'int','precision' => '11','default' => '1'), |
|
216 | - 'location' => array('type' => 'varchar','precision' => '100'), |
|
217 | - 'bookable' => array('type' => 'varchar','precision' => '1'), |
|
218 | - 'buyable' => array('type' => 'varchar','precision' => '1'), |
|
219 | - 'prize' => array('type' => 'varchar','precision' => '200'), |
|
211 | + 'name' => array('type' => 'varchar', 'precision' => '100'), |
|
212 | + 'short_description' => array('type' => 'varchar', 'precision' => '100'), |
|
213 | + 'cat_id' => array('type' => 'int', 'precision' => '11', 'nullable' => False), |
|
214 | + 'quantity' => array('type' => 'int', 'precision' => '11', 'default' => '1'), |
|
215 | + 'useable' => array('type' => 'int', 'precision' => '11', 'default' => '1'), |
|
216 | + 'location' => array('type' => 'varchar', 'precision' => '100'), |
|
217 | + 'bookable' => array('type' => 'varchar', 'precision' => '1'), |
|
218 | + 'buyable' => array('type' => 'varchar', 'precision' => '1'), |
|
219 | + 'prize' => array('type' => 'varchar', 'precision' => '200'), |
|
220 | 220 | 'long_description' => array('type' => 'longtext'), |
221 | - 'picture_src' => array('type' => 'varchar','precision' => '20'), |
|
222 | - 'accessory_of' => array('type' => 'int','precision' => '11','default' => '-1') |
|
221 | + 'picture_src' => array('type' => 'varchar', 'precision' => '20'), |
|
222 | + 'accessory_of' => array('type' => 'int', 'precision' => '11', 'default' => '-1') |
|
223 | 223 | ), |
224 | 224 | 'pk' => array('res_id'), |
225 | 225 | 'fk' => array(), |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | |
235 | 235 | function resources_upgrade0_0_1_018() |
236 | 236 | { |
237 | - $GLOBALS['phpgw_setup']->oProc->AddColumn('egw_resources','storage_info',array( |
|
237 | + $GLOBALS['phpgw_setup']->oProc->AddColumn('egw_resources', 'storage_info', array( |
|
238 | 238 | 'type' => 'varchar', |
239 | 239 | 'precision' => '200' |
240 | 240 | )); |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | |
247 | 247 | function resources_upgrade0_0_1_019() |
248 | 248 | { |
249 | - $GLOBALS['phpgw_setup']->oProc->AddColumn('egw_resources','inventory_number',array( |
|
249 | + $GLOBALS['phpgw_setup']->oProc->AddColumn('egw_resources', 'inventory_number', array( |
|
250 | 250 | 'type' => 'varchar', |
251 | 251 | 'precision' => '20' |
252 | 252 | )); |
@@ -258,14 +258,14 @@ discard block |
||
258 | 258 | |
259 | 259 | function resources_upgrade0_0_1_020() |
260 | 260 | { |
261 | - $GLOBALS['egw_setup']->oProc->CreateTable('egw_resources_extra',array( |
|
261 | + $GLOBALS['egw_setup']->oProc->CreateTable('egw_resources_extra', array( |
|
262 | 262 | 'fd' => array( |
263 | - 'extra_id' => array('type' => 'int','precision' => '4','nullable' => False), |
|
264 | - 'extra_name' => array('type' => 'varchar','precision' => '40','nullable' => False), |
|
265 | - 'extra_owner' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '-1'), |
|
266 | - 'extra_value' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '') |
|
263 | + 'extra_id' => array('type' => 'int', 'precision' => '4', 'nullable' => False), |
|
264 | + 'extra_name' => array('type' => 'varchar', 'precision' => '40', 'nullable' => False), |
|
265 | + 'extra_owner' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '-1'), |
|
266 | + 'extra_value' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False, 'default' => '') |
|
267 | 267 | ), |
268 | - 'pk' => array('extra_id','extra_name','extra_owner'), |
|
268 | + 'pk' => array('extra_id', 'extra_name', 'extra_owner'), |
|
269 | 269 | 'fk' => array(), |
270 | 270 | 'ix' => array(), |
271 | 271 | 'uc' => array() |
@@ -298,20 +298,20 @@ discard block |
||
298 | 298 | Vfs::load_wrapper('sqlfs'); |
299 | 299 | if (Vfs::is_dir('/resources/pictures')) |
300 | 300 | { |
301 | - Vfs::remove('/resources/pictures/thumbs'); // remove thumb dir incl. thumbnails |
|
302 | - foreach(Vfs::find('sqlfs://default/resources/pictures',array('url' => true)) as $url) |
|
301 | + Vfs::remove('/resources/pictures/thumbs'); // remove thumb dir incl. thumbnails |
|
302 | + foreach (Vfs::find('sqlfs://default/resources/pictures', array('url' => true)) as $url) |
|
303 | 303 | { |
304 | - if (is_numeric($id = basename($url,'.jpg'))) |
|
304 | + if (is_numeric($id = basename($url, '.jpg'))) |
|
305 | 305 | { |
306 | 306 | if (!Vfs::is_dir($dir = "/apps/resources/$id")) |
307 | 307 | { |
308 | - Vfs::mkdir($dir,0777,STREAM_MKDIR_RECURSIVE); |
|
308 | + Vfs::mkdir($dir, 0777, STREAM_MKDIR_RECURSIVE); |
|
309 | 309 | } |
310 | - rename($url,'sqlfs://default'.$dir.'/.picture.jpg'); // we need to rename on the same wrapper! |
|
310 | + rename($url, 'sqlfs://default'.$dir.'/.picture.jpg'); // we need to rename on the same wrapper! |
|
311 | 311 | } |
312 | 312 | } |
313 | - Vfs::rmdir('/resources/pictures',0); |
|
314 | - Vfs::rmdir('/resources',0); |
|
313 | + Vfs::rmdir('/resources/pictures', 0); |
|
314 | + Vfs::rmdir('/resources', 0); |
|
315 | 315 | } |
316 | 316 | return $GLOBALS['setup_info']['resources']['currentver'] = '1.6'; |
317 | 317 | } |
@@ -326,14 +326,14 @@ discard block |
||
326 | 326 | function resources_upgrade1_8() |
327 | 327 | { |
328 | 328 | // add location category required for CalDAV to distinguish between locations and resources |
329 | - $GLOBALS['egw_setup']->db->insert($GLOBALS['egw_setup']->cats_table,array('cat_parent' => 0, 'cat_owner' => Api\Categories::GLOBAL_ACCOUNT,'cat_access' => 'public','cat_appname' => 'resources','cat_name' => 'Locations','cat_description' => 'This category has been added by setup','last_mod' => time()),false,__LINE__,__FILE__); |
|
330 | - $locations_cat_id = $GLOBALS['egw_setup']->db->get_last_insert_id($GLOBALS['egw_setup']->cats_table,'cat_id'); |
|
329 | + $GLOBALS['egw_setup']->db->insert($GLOBALS['egw_setup']->cats_table, array('cat_parent' => 0, 'cat_owner' => Api\Categories::GLOBAL_ACCOUNT, 'cat_access' => 'public', 'cat_appname' => 'resources', 'cat_name' => 'Locations', 'cat_description' => 'This category has been added by setup', 'last_mod' => time()), false, __LINE__, __FILE__); |
|
330 | + $locations_cat_id = $GLOBALS['egw_setup']->db->get_last_insert_id($GLOBALS['egw_setup']->cats_table, 'cat_id'); |
|
331 | 331 | Api\Config::save_value('location_cats', $locations_cat_id, 'resources'); |
332 | 332 | |
333 | 333 | // Give default group all rights to this general cat |
334 | - $defaultgroup = $GLOBALS['egw_setup']->add_account('Default','Default','Group',False,False); |
|
335 | - $GLOBALS['egw_setup']->add_acl('resources','run',$defaultgroup); |
|
336 | - $GLOBALS['egw_setup']->add_acl('resources',"L$locations_cat_id",$defaultgroup,399); |
|
334 | + $defaultgroup = $GLOBALS['egw_setup']->add_account('Default', 'Default', 'Group', False, False); |
|
335 | + $GLOBALS['egw_setup']->add_acl('resources', 'run', $defaultgroup); |
|
336 | + $GLOBALS['egw_setup']->add_acl('resources', "L$locations_cat_id", $defaultgroup, 399); |
|
337 | 337 | |
338 | 338 | return $GLOBALS['setup_info']['resources']['currentver'] = '1.9.001'; |
339 | 339 | } |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | |
342 | 342 | function resources_upgrade1_9_001() |
343 | 343 | { |
344 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_resources','deleted',array( |
|
344 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_resources', 'deleted', array( |
|
345 | 345 | 'type' => 'int', |
346 | 346 | 'precision' => '8' |
347 | 347 | )); |
@@ -358,22 +358,22 @@ discard block |
||
358 | 358 | |
359 | 359 | function resources_upgrade1_9_003() |
360 | 360 | { |
361 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_resources','res_creator',array( |
|
361 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_resources', 'res_creator', array( |
|
362 | 362 | 'type' => 'int', |
363 | 363 | 'meta' => 'user', |
364 | 364 | 'precision' => '11' |
365 | 365 | )); |
366 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_resources','res_created',array( |
|
366 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_resources', 'res_created', array( |
|
367 | 367 | 'type' => 'int', |
368 | 368 | 'meta' => 'timestamp', |
369 | 369 | 'precision' => '8' |
370 | 370 | )); |
371 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_resources','res_modifier',array( |
|
371 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_resources', 'res_modifier', array( |
|
372 | 372 | 'type' => 'int', |
373 | 373 | 'meta' => 'user', |
374 | 374 | 'precision' => '11' |
375 | 375 | )); |
376 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_resources','res_modified',array( |
|
376 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_resources', 'res_modified', array( |
|
377 | 377 | 'type' => 'int', |
378 | 378 | 'meta' => 'timestamp', |
379 | 379 | 'precision' => '8' |
@@ -333,7 +333,7 @@ |
||
333 | 333 | // Give default group all rights to this general cat |
334 | 334 | $defaultgroup = $GLOBALS['egw_setup']->add_account('Default','Default','Group',False,False); |
335 | 335 | $GLOBALS['egw_setup']->add_acl('resources','run',$defaultgroup); |
336 | - $GLOBALS['egw_setup']->add_acl('resources',"L$locations_cat_id",$defaultgroup,399); |
|
336 | + $GLOBALS['egw_setup']->add_acl('resources',"l$locations_cat_id",$defaultgroup,399); |
|
337 | 337 | |
338 | 338 | return $GLOBALS['setup_info']['resources']['currentver'] = '1.9.001'; |
339 | 339 | } |
@@ -14,26 +14,26 @@ discard block |
||
14 | 14 | $resources_table_prefix = 'egw_resources'; |
15 | 15 | |
16 | 16 | // Add a general category for resources |
17 | -$GLOBALS['egw_setup']->db->insert($GLOBALS['egw_setup']->cats_table,array('cat_parent' => 0, 'cat_owner' => Api\Categories::GLOBAL_ACCOUNT,'cat_access' => 'public','cat_appname' => 'resources','cat_name' => 'General resources','cat_description' => 'This category has been added by setup','last_mod' => time()),false,__LINE__,__FILE__); |
|
18 | -$cat_id = $GLOBALS['egw_setup']->db->get_last_insert_id($GLOBALS['egw_setup']->cats_table,'cat_id'); |
|
19 | -$GLOBALS['egw_setup']->db->insert($GLOBALS['egw_setup']->cats_table,array('cat_parent' => 0, 'cat_owner' => Api\Categories::GLOBAL_ACCOUNT,'cat_access' => 'public','cat_appname' => 'resources','cat_name' => 'Locations','cat_description' => 'This category has been added by setup','last_mod' => time()),false,__LINE__,__FILE__); |
|
20 | -$locations_cat_id = $GLOBALS['egw_setup']->db->get_last_insert_id($GLOBALS['egw_setup']->cats_table,'cat_id'); |
|
17 | +$GLOBALS['egw_setup']->db->insert($GLOBALS['egw_setup']->cats_table, array('cat_parent' => 0, 'cat_owner' => Api\Categories::GLOBAL_ACCOUNT, 'cat_access' => 'public', 'cat_appname' => 'resources', 'cat_name' => 'General resources', 'cat_description' => 'This category has been added by setup', 'last_mod' => time()), false, __LINE__, __FILE__); |
|
18 | +$cat_id = $GLOBALS['egw_setup']->db->get_last_insert_id($GLOBALS['egw_setup']->cats_table, 'cat_id'); |
|
19 | +$GLOBALS['egw_setup']->db->insert($GLOBALS['egw_setup']->cats_table, array('cat_parent' => 0, 'cat_owner' => Api\Categories::GLOBAL_ACCOUNT, 'cat_access' => 'public', 'cat_appname' => 'resources', 'cat_name' => 'Locations', 'cat_description' => 'This category has been added by setup', 'last_mod' => time()), false, __LINE__, __FILE__); |
|
20 | +$locations_cat_id = $GLOBALS['egw_setup']->db->get_last_insert_id($GLOBALS['egw_setup']->cats_table, 'cat_id'); |
|
21 | 21 | Api\Config::save_value('location_cats', $locations_cat_id, 'resources'); |
22 | 22 | |
23 | 23 | // Give default group all rights to this general cat |
24 | -$defaultgroup = $GLOBALS['egw_setup']->add_account('Default','Default','Group',False,False); |
|
25 | -$GLOBALS['egw_setup']->add_acl('resources','run',$defaultgroup); |
|
26 | -$GLOBALS['egw_setup']->add_acl('resources',"L$cat_id",$defaultgroup,399); |
|
27 | -$GLOBALS['egw_setup']->add_acl('resources',"L$locations_cat_id",$defaultgroup,399); |
|
24 | +$defaultgroup = $GLOBALS['egw_setup']->add_account('Default', 'Default', 'Group', False, False); |
|
25 | +$GLOBALS['egw_setup']->add_acl('resources', 'run', $defaultgroup); |
|
26 | +$GLOBALS['egw_setup']->add_acl('resources', "L$cat_id", $defaultgroup, 399); |
|
27 | +$GLOBALS['egw_setup']->add_acl('resources', "L$locations_cat_id", $defaultgroup, 399); |
|
28 | 28 | |
29 | 29 | // Add two rooms to give user an idea of what resources is... |
30 | 30 | $oProc->query("INSERT INTO {$resources_table_prefix} (name,cat_id,bookable,picture_src,accessory_of) VALUES ( 'Meeting room 1',$locations_cat_id,1,'cat_src',-1)"); |
31 | 31 | $oProc->query("INSERT INTO {$resources_table_prefix} (name,cat_id,bookable,picture_src,accessory_of) VALUES ( 'Meeting room 2',$locations_cat_id,1,'cat_src',-1)"); |
32 | -$res_id = $oProc->m_odb->get_last_insert_id($resources_table_prefix,'res_id'); |
|
32 | +$res_id = $oProc->m_odb->get_last_insert_id($resources_table_prefix, 'res_id'); |
|
33 | 33 | $oProc->query("INSERT INTO {$resources_table_prefix} (name,cat_id,bookable,picture_src,accessory_of) VALUES ( 'Fixed Beamer',$cat_id,0,'cat_src',$res_id)"); |
34 | 34 | |
35 | 35 | // Turn on history by default |
36 | -foreach(array( |
|
36 | +foreach (array( |
|
37 | 37 | 'history' => 'history', |
38 | 38 | ) as $name => $value) |
39 | 39 | { |
@@ -43,10 +43,10 @@ discard block |
||
43 | 43 | 'config_app' => 'resources', |
44 | 44 | 'config_name' => $name, |
45 | 45 | 'config_value' => $value, |
46 | - ),array( |
|
46 | + ), array( |
|
47 | 47 | 'config_app' => 'resources', |
48 | 48 | 'config_name' => $name, |
49 | - ),__LINE__,__FILE__ |
|
49 | + ), __LINE__, __FILE__ |
|
50 | 50 | ); |
51 | 51 | } |
52 | 52 |
@@ -23,8 +23,8 @@ |
||
23 | 23 | // Give default group all rights to this general cat |
24 | 24 | $defaultgroup = $GLOBALS['egw_setup']->add_account('Default','Default','Group',False,False); |
25 | 25 | $GLOBALS['egw_setup']->add_acl('resources','run',$defaultgroup); |
26 | -$GLOBALS['egw_setup']->add_acl('resources',"L$cat_id",$defaultgroup,399); |
|
27 | -$GLOBALS['egw_setup']->add_acl('resources',"L$locations_cat_id",$defaultgroup,399); |
|
26 | +$GLOBALS['egw_setup']->add_acl('resources',"l$cat_id",$defaultgroup,399); |
|
27 | +$GLOBALS['egw_setup']->add_acl('resources',"l$locations_cat_id",$defaultgroup,399); |
|
28 | 28 | |
29 | 29 | // Add two rooms to give user an idea of what resources is... |
30 | 30 | $oProc->query("INSERT INTO {$resources_table_prefix} (name,cat_id,bookable,picture_src,accessory_of) VALUES ( 'Meeting room 1',$locations_cat_id,1,'cat_src',-1)"); |
@@ -44,7 +44,7 @@ |
||
44 | 44 | 'long_description' => lang('Long description'), |
45 | 45 | 'inventory_number' => lang('inventory number'), |
46 | 46 | 'accessory_of' => lang('Accessory of') |
47 | - ); |
|
47 | + ); |
|
48 | 48 | |
49 | 49 | $custom = Api\Storage\Customfields::get('resources', true); |
50 | 50 | foreach($custom as $name => $data) { |
@@ -47,7 +47,7 @@ |
||
47 | 47 | ); |
48 | 48 | |
49 | 49 | $custom = Api\Storage\Customfields::get('resources', true); |
50 | - foreach($custom as $name => $data) { |
|
50 | + foreach ($custom as $name => $data) { |
|
51 | 51 | $this->mapping_fields['#'.$name] = $data['label']; |
52 | 52 | } |
53 | 53 |
@@ -47,7 +47,8 @@ |
||
47 | 47 | ); |
48 | 48 | |
49 | 49 | $custom = Api\Storage\Customfields::get('resources', true); |
50 | - foreach($custom as $name => $data) { |
|
50 | + foreach($custom as $name => $data) |
|
51 | + { |
|
51 | 52 | $this->mapping_fields['#'.$name] = $data['label']; |
52 | 53 | } |
53 | 54 |
@@ -58,7 +58,7 @@ |
||
58 | 58 | } else { |
59 | 59 | $data['msg']= '<div class="confirm">'.lang('Unable to process confirmation.').'</div>'; |
60 | 60 | } |
61 | - } |
|
61 | + } |
|
62 | 62 | |
63 | 63 | $this->tmpl->read('resources.sitemgr_book'); |
64 | 64 |
@@ -26,17 +26,17 @@ discard block |
||
26 | 26 | */ |
27 | 27 | public function book($content = array(), $arguments = array()) |
28 | 28 | { |
29 | - Framework::includeJS('jscalendar','calendar'); |
|
29 | + Framework::includeJS('jscalendar', 'calendar'); |
|
30 | 30 | $data = array(); |
31 | 31 | $readonlys = array(); |
32 | 32 | $display_days = $_GET['planner_days'] ? $_GET['planner_days'] : 3; |
33 | - $planner_date = $_GET['date'] ? $_GET['date'] : strtotime('yesterday',$content['date'] ? $content['date'] : time()); |
|
33 | + $planner_date = $_GET['date'] ? $_GET['date'] : strtotime('yesterday', $content['date'] ? $content['date'] : time()); |
|
34 | 34 | |
35 | - if($_GET['confirm']) { |
|
36 | - $register_code = ($_GET['confirm'] && preg_match('/^[0-9a-f]{32}$/',$_GET['confirm'])) ? $_GET['confirm'] : false; |
|
37 | - if($register_code && $registration = registration_bo::confirm($register_code)) { |
|
35 | + if ($_GET['confirm']) { |
|
36 | + $register_code = ($_GET['confirm'] && preg_match('/^[0-9a-f]{32}$/', $_GET['confirm'])) ? $_GET['confirm'] : false; |
|
37 | + if ($register_code && $registration = registration_bo::confirm($register_code)) { |
|
38 | 38 | // Get calendar through link |
39 | - $links = Link::get_links('registration', $registration['reg_id'],'calendar'); |
|
39 | + $links = Link::get_links('registration', $registration['reg_id'], 'calendar'); |
|
40 | 40 | $bo = new calendar_boupdate(); |
41 | 41 | $data = $bo->read(current($links)); |
42 | 42 | |
@@ -45,24 +45,24 @@ discard block |
||
45 | 45 | |
46 | 46 | // Show date of reservation, so they can see it blocked off |
47 | 47 | $display_days = 1; |
48 | - $planner_date = mktime(0,0,0,date('m',$data['start']),date('d',$data['start']),date('Y',$data['start'])); |
|
48 | + $planner_date = mktime(0, 0, 0, date('m', $data['start']), date('d', $data['start']), date('Y', $data['start'])); |
|
49 | 49 | $readonlys['__ALL__'] = true; |
50 | 50 | $content = array( |
51 | 51 | 'resource' => key($data['participant_types']['r']), |
52 | 52 | 'date' => $data['start'], |
53 | - 'time' => $data['start'] - mktime(0,0,0,date('m',$data['start']),date('d',$data['start']),date('Y',$data['start'])), |
|
53 | + 'time' => $data['start'] - mktime(0, 0, 0, date('m', $data['start']), date('d', $data['start']), date('Y', $data['start'])), |
|
54 | 54 | 'quantity' => 0 |
55 | 55 | ); |
56 | - calendar_so::split_status($data['participant_types']['r'][$content['resource']], $content['quantity'],$role); |
|
57 | - $data['msg']= '<div class="confirm">'.lang('Registration confirmed %1', Api\DateTime::to($data['start'])) .'</div>'; |
|
56 | + calendar_so::split_status($data['participant_types']['r'][$content['resource']], $content['quantity'], $role); |
|
57 | + $data['msg'] = '<div class="confirm">'.lang('Registration confirmed %1', Api\DateTime::to($data['start'])).'</div>'; |
|
58 | 58 | } else { |
59 | - $data['msg']= '<div class="confirm">'.lang('Unable to process confirmation.').'</div>'; |
|
59 | + $data['msg'] = '<div class="confirm">'.lang('Unable to process confirmation.').'</div>'; |
|
60 | 60 | } |
61 | 61 | } |
62 | 62 | |
63 | 63 | $this->tmpl->read('resources.sitemgr_book'); |
64 | 64 | |
65 | - if(!$arguments['resource'] && !($arguments['resource'] = $content['resource'])) return false; |
|
65 | + if (!$arguments['resource'] && !($arguments['resource'] = $content['resource'])) return false; |
|
66 | 66 | $data += $this->bo->read($arguments['resource']); |
67 | 67 | |
68 | 68 | $data['quantity'] = $content['quantity'] ? $content['quantity'] : 2; |
@@ -81,11 +81,11 @@ discard block |
||
81 | 81 | $preserve['include_group'] = $arguments['include_group'] ? $arguments['include_group'] : $content['include_group']; |
82 | 82 | |
83 | 83 | // Check for valid time |
84 | - if($data['date'] && $content['book']) |
|
84 | + if ($data['date'] && $content['book']) |
|
85 | 85 | { |
86 | - $start_time = $data['date'] + (is_array($data['time']) ? $data['time']['hour']*3600 + $data['time']['minute']*60 : $data['time']); |
|
86 | + $start_time = $data['date'] + (is_array($data['time']) ? $data['time']['hour'] * 3600 + $data['time']['minute'] * 60 : $data['time']); |
|
87 | 87 | // Use sitemgr's default appointment length |
88 | - if($GLOBALS['egw_info']['user']['account_lid'] != $GLOBALS['sitemgr_info']['anonymous_user']) |
|
88 | + if ($GLOBALS['egw_info']['user']['account_lid'] != $GLOBALS['sitemgr_info']['anonymous_user']) |
|
89 | 89 | { |
90 | 90 | $preferences = new Api\Preferences($GLOBALS['egw']->accounts->name2id($GLOBALS['sitemgr_info']['anonymous_user'])); |
91 | 91 | $preferences = $preferences->read_repository(); |
@@ -100,21 +100,21 @@ discard block |
||
100 | 100 | $config = Api\Config::read('registration'); |
101 | 101 | |
102 | 102 | // Not a user, need contact |
103 | - if($GLOBALS['egw_info']['user']['account_lid'] == $GLOBALS['sitemgr_info']['anonymous_user'] && !$content['contact_id']) |
|
103 | + if ($GLOBALS['egw_info']['user']['account_lid'] == $GLOBALS['sitemgr_info']['anonymous_user'] && !$content['contact_id']) |
|
104 | 104 | { |
105 | 105 | if ($config['pending_addressbook']) // save the contact in the addressbook |
106 | 106 | { |
107 | 107 | $content['owner'] = $config['pending_addressbook']; |
108 | - $content['private'] = 0; // in case default_private is set |
|
108 | + $content['private'] = 0; // in case default_private is set |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | $addressbook = new Api\Contacts(); |
112 | 112 | $contact_fields = $addressbook->contact_fields; |
113 | 113 | unset($contact_fields['email']); // Always present |
114 | 114 | unset($contact_fields['id']); // Address already there |
115 | - if(array_intersect_key($contact_fields,$content)) { |
|
115 | + if (array_intersect_key($contact_fields, $content)) { |
|
116 | 116 | $result = $addressbook->save($content); |
117 | - if(!$result) { |
|
117 | + if (!$result) { |
|
118 | 118 | throw new Api\Exception\NoPermission($addressbook->error); |
119 | 119 | return False; |
120 | 120 | } |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | $contact_id = $GLOBALS['egw_info']['user']['person_id']; |
131 | 131 | } |
132 | 132 | |
133 | - if($contact) { |
|
133 | + if ($contact) { |
|
134 | 134 | // Make event |
135 | 135 | $event = array( |
136 | 136 | 'title' => Link::title('addressbook', $contact_id), |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | $contact => calendar_so::combine_status('U', $data['quantity'], 'REQ-PARTICIPANT') |
142 | 142 | ) |
143 | 143 | ); |
144 | - if($preserve['include_group']) |
|
144 | + if ($preserve['include_group']) |
|
145 | 145 | { |
146 | 146 | $event['participants'][$preserve['include_group']] = calendar_so::combine_status('U', 1, 'REQ-PARTICIPANT'); |
147 | 147 | } |
@@ -150,21 +150,21 @@ discard block |
||
150 | 150 | |
151 | 151 | // Show date of reservation, so they can see it blocked off |
152 | 152 | $display_days = 1; |
153 | - $planner_date = mktime(0,0,0,date('m',$event['start']),date('d',$event['start']),date('Y',$event['start'])); |
|
153 | + $planner_date = mktime(0, 0, 0, date('m', $event['start']), date('d', $event['start']), date('Y', $event['start'])); |
|
154 | 154 | |
155 | 155 | // Free time search |
156 | - if(!is_numeric($result)) |
|
156 | + if (!is_numeric($result)) |
|
157 | 157 | { |
158 | 158 | $form = new calendar_uiforms(); |
159 | 159 | $freetime = $form->freetime('r'.$data['res_id'], |
160 | - strtotime($GLOBALS['egw_info']['user']['preferences']['calendar']['workdaystarts'] . ':00',$start_time), |
|
161 | - strtotime($GLOBALS['egw_info']['user']['preferences']['calendar']['workdayends'] . ':00 ',$end_time), |
|
160 | + strtotime($GLOBALS['egw_info']['user']['preferences']['calendar']['workdaystarts'].':00', $start_time), |
|
161 | + strtotime($GLOBALS['egw_info']['user']['preferences']['calendar']['workdayends'].':00 ', $end_time), |
|
162 | 162 | $duration |
163 | 163 | ); |
164 | 164 | $data += $content; |
165 | 165 | $data['msg'] = lang('Please choose a different time:')."\n"; |
166 | - foreach($freetime as $slot) { |
|
167 | - $data['msg'] .= Api\DateTime::to($slot['start']) . ' - ' . Api\DateTime::to($slot['end'])."<br />\n"; |
|
166 | + foreach ($freetime as $slot) { |
|
167 | + $data['msg'] .= Api\DateTime::to($slot['start']).' - '.Api\DateTime::to($slot['end'])."<br />\n"; |
|
168 | 168 | } |
169 | 169 | } |
170 | 170 | elseif ($preserve['confirmation'] && $contact_id && $result) |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | 'post_confirm_hook' => 'resources.resources_reserve.confirm', |
177 | 177 | 'sitemgr_version' => $preserve['sitemgr_version'] |
178 | 178 | ), false); |
179 | - if(is_numeric($reg_id)) |
|
179 | + if (is_numeric($reg_id)) |
|
180 | 180 | { |
181 | 181 | // Link to event |
182 | 182 | Link::link('registration', $reg_id, 'calendar', $result); |
@@ -185,10 +185,10 @@ discard block |
||
185 | 185 | // Send email |
186 | 186 | $email_info = $config + array( |
187 | 187 | 'title' => $data['name'], |
188 | - 'subject' => $data['name'] . ' ' . Api\DateTime::to($start_time), |
|
188 | + 'subject' => $data['name'].' '.Api\DateTime::to($start_time), |
|
189 | 189 | 'link' => $preserve['link'], |
190 | 190 | ); |
191 | - if($preserve['email_message']) |
|
191 | + if ($preserve['email_message']) |
|
192 | 192 | { |
193 | 193 | $email_info['message'] = lang($preserve['email_message'], |
194 | 194 | Api\DateTime::to($start_time), |
@@ -205,23 +205,23 @@ discard block |
||
205 | 205 | $data['picture'] = $this->bo->get_picture($data); |
206 | 206 | |
207 | 207 | // Not a user, need contact |
208 | - if($GLOBALS['egw_info']['user']['account_lid'] == $GLOBALS['sitemgr_info']['anonymous_user'] && !$content['contact_id']) |
|
208 | + if ($GLOBALS['egw_info']['user']['account_lid'] == $GLOBALS['sitemgr_info']['anonymous_user'] && !$content['contact_id']) |
|
209 | 209 | { |
210 | 210 | $data['contact_form'] = $preserve['contact_form']; |
211 | 211 | $data['show_contact'] = !$preserve['contact_form']; |
212 | 212 | } |
213 | 213 | |
214 | 214 | $cal_user = array('r'.$arguments['resource']); |
215 | - foreach($this->bo->get_acc_list($data['res_id']) as $acc_id => $name) |
|
215 | + foreach ($this->bo->get_acc_list($data['res_id']) as $acc_id => $name) |
|
216 | 216 | { |
217 | 217 | $cal_user[] = 'r'.$acc_id; |
218 | 218 | } |
219 | 219 | |
220 | - if(!$data['date']) $data['date'] = strtotime('tomorrow'); |
|
221 | - if(!$data['time']) $data['time']['hour'] = $GLOBALS['egw_info']['user']['preferences']['calendar']['workdaystarts']; |
|
220 | + if (!$data['date']) $data['date'] = strtotime('tomorrow'); |
|
221 | + if (!$data['time']) $data['time']['hour'] = $GLOBALS['egw_info']['user']['preferences']['calendar']['workdaystarts']; |
|
222 | 222 | |
223 | 223 | // Use sitemgr's default appointment length |
224 | - if($GLOBALS['egw_info']['user']['account_lid'] != $GLOBALS['sitemgr_info']['anonymous_user']) |
|
224 | + if ($GLOBALS['egw_info']['user']['account_lid'] != $GLOBALS['sitemgr_info']['anonymous_user']) |
|
225 | 225 | { |
226 | 226 | $preferences = new Api\Preferences($GLOBALS['egw']->accounts->name2id($GLOBALS['sitemgr_info']['anonymous_user'])); |
227 | 227 | $preferences = $preferences->read_repository(); |
@@ -234,28 +234,28 @@ discard block |
||
234 | 234 | // Leading 0 |
235 | 235 | $data['duration'] = '0'.$data['duration']; |
236 | 236 | |
237 | - if(!$GLOBALS['egw_info']['user']['apps']['resources'] || !$this->bo->get_calendar_info($data['res_id']) || // Needed for booking |
|
237 | + if (!$GLOBALS['egw_info']['user']['apps']['resources'] || !$this->bo->get_calendar_info($data['res_id']) || // Needed for booking |
|
238 | 238 | !$GLOBALS['egw_info']['user']['apps']['calendar'] // Needed for updating schedule |
239 | 239 | ) |
240 | 240 | { |
241 | - $data['planner'] = 'Permission error - site not configured properly. Need ' . lang('resources') . ' & ' . lang('calendar'); |
|
241 | + $data['planner'] = 'Permission error - site not configured properly. Need '.lang('resources').' & '.lang('calendar'); |
|
242 | 242 | } |
243 | 243 | else |
244 | 244 | { |
245 | 245 | $data['planner'] = $this->get_planner( |
246 | 246 | $arguments['resource'], |
247 | - $planner_date ? $planner_date : strtotime('yesterday',$date), // Show day before, too |
|
247 | + $planner_date ? $planner_date : strtotime('yesterday', $date), // Show day before, too |
|
248 | 248 | $display_days, |
249 | 249 | $preserve['link'] |
250 | 250 | ); |
251 | 251 | } |
252 | 252 | |
253 | 253 | // Restrict times to working hours |
254 | - for($i = $GLOBALS['egw_info']['user']['preferences']['calendar']['workdaystarts']; $i < $GLOBALS['egw_info']['user']['preferences']['calendar']['workdayends']; $i++) |
|
254 | + for ($i = $GLOBALS['egw_info']['user']['preferences']['calendar']['workdaystarts']; $i < $GLOBALS['egw_info']['user']['preferences']['calendar']['workdayends']; $i++) |
|
255 | 255 | { |
256 | - if($GLOBALS['egw_info']['user']['preferences']['common']['timeformat'] == '12') |
|
256 | + if ($GLOBALS['egw_info']['user']['preferences']['common']['timeformat'] == '12') |
|
257 | 257 | { |
258 | - $sel_options['hour'][$i] = ($i < '12' ? $i .' am' : ($i > 12 ? $i -12 : $i).' pm'); |
|
258 | + $sel_options['hour'][$i] = ($i < '12' ? $i.' am' : ($i > 12 ? $i - 12 : $i).' pm'); |
|
259 | 259 | } |
260 | 260 | else |
261 | 261 | { |
@@ -263,14 +263,14 @@ discard block |
||
263 | 263 | } |
264 | 264 | } |
265 | 265 | |
266 | - return $this->tmpl->exec('resources.resources_reserve.book',$data,$sel_options,$readonlys,$preserve); |
|
266 | + return $this->tmpl->exec('resources.resources_reserve.book', $data, $sel_options, $readonlys, $preserve); |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | public function ajax_update_planner($resource_id, $date) { |
270 | 270 | $response = Api\Json\Response::get(); |
271 | - $response->assign('exec[planner_div]','innerHTML',$this->get_planner( |
|
271 | + $response->assign('exec[planner_div]', 'innerHTML', $this->get_planner( |
|
272 | 272 | $resource_id, |
273 | - strtotime('yesterday',$date), |
|
273 | + strtotime('yesterday', $date), |
|
274 | 274 | 3, |
275 | 275 | $_SERVER['HTTP_REFERER'] |
276 | 276 | )); |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | // Need to add this in explicitly, or it may be lost if use clicks a day |
297 | 297 | $calendar->search_params['users'][] = 'r'.$resource_id; |
298 | 298 | $calendar->search_params['users'][] = $GLOBALS['egw_info']['user']['account_id']; |
299 | - $calendar->allowEdit = false; // switches off all edit popups |
|
299 | + $calendar->allowEdit = false; // switches off all edit popups |
|
300 | 300 | |
301 | 301 | $planner = '<style type="text/css">'."\n". |
302 | 302 | '@import url('.$GLOBALS['egw_info']['server']['webserver_url'].'/calendar/templates/default/app.css'.");\n". |
@@ -318,10 +318,10 @@ discard block |
||
318 | 318 | public function confirm($registration) |
319 | 319 | { |
320 | 320 | // Get calendar through link |
321 | - $links = Link::get_links('registration', $registration['reg_id'],'calendar'); |
|
321 | + $links = Link::get_links('registration', $registration['reg_id'], 'calendar'); |
|
322 | 322 | $bo = new calendar_boupdate(); |
323 | 323 | $event = $bo->read(current($links)); |
324 | - if($registration['status'] == registration_bo::CONFIRMED) |
|
324 | + if ($registration['status'] == registration_bo::CONFIRMED) |
|
325 | 325 | { |
326 | 326 | $bo->set_status(current($links), 'c'.$registration['contact_id'], 'A'); |
327 | 327 | } |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | { |
330 | 330 | $bo->delete(current($links)); |
331 | 331 | // Remove contact ID, or registration will try to purge the account |
332 | - if($registration['account_id']) |
|
332 | + if ($registration['account_id']) |
|
333 | 333 | { |
334 | 334 | unset($registration['contact_id']); |
335 | 335 | } |
@@ -14,9 +14,11 @@ discard block |
||
14 | 14 | use EGroupware\Api\Link; |
15 | 15 | use EGroupware\Api\Framework; |
16 | 16 | |
17 | -class resources_reserve { |
|
17 | +class resources_reserve |
|
18 | +{ |
|
18 | 19 | |
19 | - public function __construct() { |
|
20 | + public function __construct() |
|
21 | + { |
|
20 | 22 | $this->tmpl = new etemplate(); |
21 | 23 | $this->bo = new resources_bo(); |
22 | 24 | } |
@@ -32,9 +34,11 @@ discard block |
||
32 | 34 | $display_days = $_GET['planner_days'] ? $_GET['planner_days'] : 3; |
33 | 35 | $planner_date = $_GET['date'] ? $_GET['date'] : strtotime('yesterday',$content['date'] ? $content['date'] : time()); |
34 | 36 | |
35 | - if($_GET['confirm']) { |
|
37 | + if($_GET['confirm']) |
|
38 | + { |
|
36 | 39 | $register_code = ($_GET['confirm'] && preg_match('/^[0-9a-f]{32}$/',$_GET['confirm'])) ? $_GET['confirm'] : false; |
37 | - if($register_code && $registration = registration_bo::confirm($register_code)) { |
|
40 | + if($register_code && $registration = registration_bo::confirm($register_code)) |
|
41 | + { |
|
38 | 42 | // Get calendar through link |
39 | 43 | $links = Link::get_links('registration', $registration['reg_id'],'calendar'); |
40 | 44 | $bo = new calendar_boupdate(); |
@@ -55,14 +59,19 @@ discard block |
||
55 | 59 | ); |
56 | 60 | calendar_so::split_status($data['participant_types']['r'][$content['resource']], $content['quantity'],$role); |
57 | 61 | $data['msg']= '<div class="confirm">'.lang('Registration confirmed %1', Api\DateTime::to($data['start'])) .'</div>'; |
58 | - } else { |
|
62 | + } |
|
63 | + else |
|
64 | + { |
|
59 | 65 | $data['msg']= '<div class="confirm">'.lang('Unable to process confirmation.').'</div>'; |
60 | 66 | } |
61 | 67 | } |
62 | 68 | |
63 | 69 | $this->tmpl->read('resources.sitemgr_book'); |
64 | 70 | |
65 | - if(!$arguments['resource'] && !($arguments['resource'] = $content['resource'])) return false; |
|
71 | + if(!$arguments['resource'] && !($arguments['resource'] = $content['resource'])) |
|
72 | + { |
|
73 | + return false; |
|
74 | + } |
|
66 | 75 | $data += $this->bo->read($arguments['resource']); |
67 | 76 | |
68 | 77 | $data['quantity'] = $content['quantity'] ? $content['quantity'] : 2; |
@@ -102,9 +111,12 @@ discard block |
||
102 | 111 | // Not a user, need contact |
103 | 112 | if($GLOBALS['egw_info']['user']['account_lid'] == $GLOBALS['sitemgr_info']['anonymous_user'] && !$content['contact_id']) |
104 | 113 | { |
105 | - if ($config['pending_addressbook']) // save the contact in the addressbook |
|
114 | + if ($config['pending_addressbook']) |
|
115 | + { |
|
116 | + // save the contact in the addressbook |
|
106 | 117 | { |
107 | 118 | $content['owner'] = $config['pending_addressbook']; |
119 | + } |
|
108 | 120 | $content['private'] = 0; // in case default_private is set |
109 | 121 | } |
110 | 122 | |
@@ -112,9 +124,11 @@ discard block |
||
112 | 124 | $contact_fields = $addressbook->contact_fields; |
113 | 125 | unset($contact_fields['email']); // Always present |
114 | 126 | unset($contact_fields['id']); // Address already there |
115 | - if(array_intersect_key($contact_fields,$content)) { |
|
127 | + if(array_intersect_key($contact_fields,$content)) |
|
128 | + { |
|
116 | 129 | $result = $addressbook->save($content); |
117 | - if(!$result) { |
|
130 | + if(!$result) |
|
131 | + { |
|
118 | 132 | throw new Api\Exception\NoPermission($addressbook->error); |
119 | 133 | return False; |
120 | 134 | } |
@@ -130,7 +144,8 @@ discard block |
||
130 | 144 | $contact_id = $GLOBALS['egw_info']['user']['person_id']; |
131 | 145 | } |
132 | 146 | |
133 | - if($contact) { |
|
147 | + if($contact) |
|
148 | + { |
|
134 | 149 | // Make event |
135 | 150 | $event = array( |
136 | 151 | 'title' => Link::title('addressbook', $contact_id), |
@@ -163,7 +178,8 @@ discard block |
||
163 | 178 | ); |
164 | 179 | $data += $content; |
165 | 180 | $data['msg'] = lang('Please choose a different time:')."\n"; |
166 | - foreach($freetime as $slot) { |
|
181 | + foreach($freetime as $slot) |
|
182 | + { |
|
167 | 183 | $data['msg'] .= Api\DateTime::to($slot['start']) . ' - ' . Api\DateTime::to($slot['end'])."<br />\n"; |
168 | 184 | } |
169 | 185 | } |
@@ -217,8 +233,14 @@ discard block |
||
217 | 233 | $cal_user[] = 'r'.$acc_id; |
218 | 234 | } |
219 | 235 | |
220 | - if(!$data['date']) $data['date'] = strtotime('tomorrow'); |
|
221 | - if(!$data['time']) $data['time']['hour'] = $GLOBALS['egw_info']['user']['preferences']['calendar']['workdaystarts']; |
|
236 | + if(!$data['date']) |
|
237 | + { |
|
238 | + $data['date'] = strtotime('tomorrow'); |
|
239 | + } |
|
240 | + if(!$data['time']) |
|
241 | + { |
|
242 | + $data['time']['hour'] = $GLOBALS['egw_info']['user']['preferences']['calendar']['workdaystarts']; |
|
243 | + } |
|
222 | 244 | |
223 | 245 | // Use sitemgr's default appointment length |
224 | 246 | if($GLOBALS['egw_info']['user']['account_lid'] != $GLOBALS['sitemgr_info']['anonymous_user']) |
@@ -236,8 +258,7 @@ discard block |
||
236 | 258 | |
237 | 259 | if(!$GLOBALS['egw_info']['user']['apps']['resources'] || !$this->bo->get_calendar_info($data['res_id']) || // Needed for booking |
238 | 260 | !$GLOBALS['egw_info']['user']['apps']['calendar'] // Needed for updating schedule |
239 | - ) |
|
240 | - { |
|
261 | + ) { |
|
241 | 262 | $data['planner'] = 'Permission error - site not configured properly. Need ' . lang('resources') . ' & ' . lang('calendar'); |
242 | 263 | } |
243 | 264 | else |
@@ -266,7 +287,8 @@ discard block |
||
266 | 287 | return $this->tmpl->exec('resources.resources_reserve.book',$data,$sel_options,$readonlys,$preserve); |
267 | 288 | } |
268 | 289 | |
269 | - public function ajax_update_planner($resource_id, $date) { |
|
290 | + public function ajax_update_planner($resource_id, $date) |
|
291 | + { |
|
270 | 292 | $response = Api\Json\Response::get(); |
271 | 293 | $response->assign('exec[planner_div]','innerHTML',$this->get_planner( |
272 | 294 | $resource_id, |
@@ -26,26 +26,26 @@ discard block |
||
26 | 26 | |
27 | 27 | // Custom fields |
28 | 28 | $custom = Api\Storage\Customfields::get('resources', true); |
29 | - foreach($custom as $name => $data) { |
|
29 | + foreach ($custom as $name => $data) { |
|
30 | 30 | $this->export_fields['#'.$name] = $data['label']; |
31 | 31 | } |
32 | 32 | } |
33 | 33 | |
34 | 34 | public function wizard_step50(&$content, &$sel_options, &$readonlys, &$preserv) { |
35 | - if($this->debug || true) error_log(get_class($this) . '::wizard_step50->$content '.print_r($content,true)); |
|
35 | + if ($this->debug || true) error_log(get_class($this).'::wizard_step50->$content '.print_r($content, true)); |
|
36 | 36 | // return |
37 | 37 | if ($content['step'] == 'wizard_step50') |
38 | 38 | { |
39 | 39 | switch (array_search('pressed', $content['button'])) |
40 | 40 | { |
41 | 41 | case 'next': |
42 | - return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'],1); |
|
42 | + return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'], 1); |
|
43 | 43 | case 'previous' : |
44 | - return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'],-1); |
|
44 | + return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'], -1); |
|
45 | 45 | case 'finish': |
46 | 46 | return 'wizard_finish'; |
47 | 47 | default : |
48 | - return $this->wizard_step50($content,$sel_options,$readonlys,$preserv); |
|
48 | + return $this->wizard_step50($content, $sel_options, $readonlys, $preserv); |
|
49 | 49 | } |
50 | 50 | } |
51 | 51 | // init step |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | unset ($preserv['button']); |
58 | 58 | $fields = array('pm_used_time', 'pm_planned_time', 'pm_replanned_time'); |
59 | 59 | $sel_options = array_fill_keys($fields, array('h' => lang('hours'), 'd' => lang('days'))); |
60 | - foreach($fields as $field) { |
|
60 | + foreach ($fields as $field) { |
|
61 | 61 | $content[$field] = $content[$field] ? $content[$field] : $content['plugin_options'][$field]; |
62 | 62 | } |
63 | 63 | } |
@@ -14,7 +14,8 @@ discard block |
||
14 | 14 | |
15 | 15 | class resources_wizard_export_csv extends importexport_wizard_basic_export_csv |
16 | 16 | { |
17 | - public function __construct() { |
|
17 | + public function __construct() |
|
18 | + { |
|
18 | 19 | parent::__construct(); |
19 | 20 | |
20 | 21 | // Field mapping |
@@ -26,13 +27,18 @@ discard block |
||
26 | 27 | |
27 | 28 | // Custom fields |
28 | 29 | $custom = Api\Storage\Customfields::get('resources', true); |
29 | - foreach($custom as $name => $data) { |
|
30 | + foreach($custom as $name => $data) |
|
31 | + { |
|
30 | 32 | $this->export_fields['#'.$name] = $data['label']; |
31 | 33 | } |
32 | 34 | } |
33 | 35 | |
34 | - public function wizard_step50(&$content, &$sel_options, &$readonlys, &$preserv) { |
|
35 | - if($this->debug || true) error_log(get_class($this) . '::wizard_step50->$content '.print_r($content,true)); |
|
36 | + public function wizard_step50(&$content, &$sel_options, &$readonlys, &$preserv) |
|
37 | + { |
|
38 | + if($this->debug || true) |
|
39 | + { |
|
40 | + error_log(get_class($this) . '::wizard_step50->$content '.print_r($content,true)); |
|
41 | + } |
|
36 | 42 | // return |
37 | 43 | if ($content['step'] == 'wizard_step50') |
38 | 44 | { |
@@ -57,7 +63,8 @@ discard block |
||
57 | 63 | unset ($preserv['button']); |
58 | 64 | $fields = array('pm_used_time', 'pm_planned_time', 'pm_replanned_time'); |
59 | 65 | $sel_options = array_fill_keys($fields, array('h' => lang('hours'), 'd' => lang('days'))); |
60 | - foreach($fields as $field) { |
|
66 | + foreach($fields as $field) |
|
67 | + { |
|
61 | 68 | $content[$field] = $content[$field] ? $content[$field] : $content['plugin_options'][$field]; |
62 | 69 | } |
63 | 70 | } |
@@ -50,30 +50,30 @@ discard block |
||
50 | 50 | */ |
51 | 51 | public function index($content = array()) |
52 | 52 | { |
53 | - if (!$GLOBALS['egw']->acl->check('run',1,'admin')) |
|
53 | + if (!$GLOBALS['egw']->acl->check('run', 1, 'admin')) |
|
54 | 54 | { |
55 | 55 | $this->deny(); |
56 | 56 | } |
57 | 57 | |
58 | 58 | $content['nm'] = array( |
59 | - 'get_rows' => 'resources.resources_acl_ui.get_rows', // I method/callback to request the data for the rows eg. 'notes.bo.get_rows' |
|
59 | + 'get_rows' => 'resources.resources_acl_ui.get_rows', // I method/callback to request the data for the rows eg. 'notes.bo.get_rows' |
|
60 | 60 | 'no_search' => True, |
61 | - 'no_filter' => True, // I disable the 1. filter |
|
62 | - 'no_filter2' => True, // I disable the 2. filter (params are the same as for filter) |
|
63 | - 'no_cat' => True, // I disable the cat-selectbox |
|
64 | - 'row_id' => 'id', // I key into row content to set it's value as row-id, eg. 'id' |
|
65 | - 'parent_id' => 'parent',// I key into row content of children linking them to their parent, also used as col_filter to query children |
|
66 | - 'dataStorePrefix'=> 'categories',// Avoid conflict with user list when in admin |
|
67 | - 'actions' => $this->get_actions(), // I array with actions, see nextmatch_widget::egw_actions |
|
61 | + 'no_filter' => True, // I disable the 1. filter |
|
62 | + 'no_filter2' => True, // I disable the 2. filter (params are the same as for filter) |
|
63 | + 'no_cat' => True, // I disable the cat-selectbox |
|
64 | + 'row_id' => 'id', // I key into row content to set it's value as row-id, eg. 'id' |
|
65 | + 'parent_id' => 'parent', // I key into row content of children linking them to their parent, also used as col_filter to query children |
|
66 | + 'dataStorePrefix'=> 'categories', // Avoid conflict with user list when in admin |
|
67 | + 'actions' => $this->get_actions(), // I array with actions, see nextmatch_widget::egw_actions |
|
68 | 68 | 'placeholder_actions' => array('add') // I Array Optional list of actions allowed on the placeholder. If not provided, it's ["add"]. |
69 | 69 | ); |
70 | 70 | $template = new Etemplate('resources.acl'); |
71 | - $GLOBALS['egw_info']['flags']['app_header'] = $GLOBALS['egw_info']['apps']['resources']['title'] . ' - ' . lang('Configure Access Permissions'); |
|
71 | + $GLOBALS['egw_info']['flags']['app_header'] = $GLOBALS['egw_info']['apps']['resources']['title'].' - '.lang('Configure Access Permissions'); |
|
72 | 72 | |
73 | 73 | $template->exec(__METHOD__, $content, $sel_options, $readonlys); |
74 | 74 | } |
75 | 75 | |
76 | - protected function get_actions($appname='resources') { |
|
76 | + protected function get_actions($appname = 'resources') { |
|
77 | 77 | |
78 | 78 | $actions = array( |
79 | 79 | 'open' => array( // does edit if allowed, otherwise view |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | 'allowOnMultiple' => false, |
83 | 83 | 'url' => 'menuaction=resources.resources_acl_ui.edit&cat_id=$id', |
84 | 84 | 'popup' => '600x420', |
85 | - 'group' => $group=1, |
|
85 | + 'group' => $group = 1, |
|
86 | 86 | ), |
87 | 87 | 'add' => array( |
88 | 88 | 'caption' => 'Add', |
@@ -105,42 +105,42 @@ discard block |
||
105 | 105 | * @param array &$readonlys eg. to disable buttons based on Acl, not use here, maybe in a derived class |
106 | 106 | * @return int total number of rows |
107 | 107 | */ |
108 | - public function get_rows(&$query,&$rows,&$readonlys) |
|
108 | + public function get_rows(&$query, &$rows, &$readonlys) |
|
109 | 109 | { |
110 | 110 | |
111 | - Api\Cache::setSession('resources','acl-nm',$query); |
|
111 | + Api\Cache::setSession('resources', 'acl-nm', $query); |
|
112 | 112 | |
113 | - if($query['filter'] > 0 || $query['col_filter']['owner']) |
|
113 | + if ($query['filter'] > 0 || $query['col_filter']['owner']) |
|
114 | 114 | { |
115 | 115 | $owner = $query['col_filter']['owner'] ? $query['col_filter']['owner'] : $query['filter']; |
116 | 116 | } |
117 | 117 | |
118 | - $cats = new Api\Categories($owner,'resources'); |
|
118 | + $cats = new Api\Categories($owner, 'resources'); |
|
119 | 119 | $parent = $query['search'] ? false : 0; |
120 | - $rows = $cats->return_sorted_array($query['start'],false,$query['search'],$query['sort'],$query['order'],'all_no_acl',$parent,true,$filter); |
|
120 | + $rows = $cats->return_sorted_array($query['start'], false, $query['search'], $query['sort'], $query['order'], 'all_no_acl', $parent, true, $filter); |
|
121 | 121 | $count = $cats->total_records; |
122 | 122 | |
123 | 123 | |
124 | 124 | $config = Api\Config::read('resources'); |
125 | 125 | $location_cats = $config['location_cats'] ? explode(',', $config['location_cats']) : array(); |
126 | 126 | |
127 | - foreach($rows as $key => &$row) |
|
127 | + foreach ($rows as $key => &$row) |
|
128 | 128 | { |
129 | - $row['owner'] = explode(',',$row['owner']); |
|
129 | + $row['owner'] = explode(',', $row['owner']); |
|
130 | 130 | |
131 | - $row['level_spacer'] = str_repeat(' ',$row['level']); |
|
131 | + $row['level_spacer'] = str_repeat(' ', $row['level']); |
|
132 | 132 | $row['location'] = (in_array($row['id'], $location_cats)); |
133 | 133 | |
134 | 134 | if ($row['data']['icon']) |
135 | 135 | { |
136 | - $row['icon_url'] = $GLOBALS['egw_info']['server']['webserver_url']. resources_bo::ICON_PATH.'/'.$row['data']['icon']; |
|
136 | + $row['icon_url'] = $GLOBALS['egw_info']['server']['webserver_url'].resources_bo::ICON_PATH.'/'.$row['data']['icon']; |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | $row['subs'] = count($row['children']); |
140 | 140 | |
141 | 141 | $row['class'] = 'level'.$row['level']; |
142 | 142 | |
143 | - foreach(self::$acl_map as $field => $acl) |
|
143 | + foreach (self::$acl_map as $field => $acl) |
|
144 | 144 | { |
145 | 145 | $row[$field] = $GLOBALS['egw']->acl->get_ids_for_location('L'.$row['id'], $acl, 'resources'); |
146 | 146 | } |
@@ -157,9 +157,9 @@ discard block |
||
157 | 157 | * @param array $content = null |
158 | 158 | * @param string $msg = '' |
159 | 159 | */ |
160 | - public function edit(array $content=null,$msg='') |
|
160 | + public function edit(array $content = null, $msg = '') |
|
161 | 161 | { |
162 | - if (!$GLOBALS['egw']->acl->check('run',1,'admin')) |
|
162 | + if (!$GLOBALS['egw']->acl->check('run', 1, 'admin')) |
|
163 | 163 | { |
164 | 164 | $this->deny(); |
165 | 165 | } |
@@ -173,23 +173,23 @@ discard block |
||
173 | 173 | } |
174 | 174 | elseif ($content['button']) |
175 | 175 | { |
176 | - $cats = new Categories($content['owner'] ? $content['owner'] : Categories::GLOBAL_ACCOUNT,'resources'); |
|
176 | + $cats = new Categories($content['owner'] ? $content['owner'] : Categories::GLOBAL_ACCOUNT, 'resources'); |
|
177 | 177 | |
178 | 178 | list($button) = each($content['button']); |
179 | 179 | unset($content['button']); |
180 | 180 | |
181 | 181 | $refresh_app = 'admin'; |
182 | 182 | |
183 | - switch($button) |
|
183 | + switch ($button) |
|
184 | 184 | { |
185 | 185 | case 'save': |
186 | 186 | case 'apply': |
187 | - if(is_array($content['owner'])) $content['owner'] = implode(',',$content['owner']); |
|
188 | - if($content['owner'] == '') $content['owner'] = 0; |
|
187 | + if (is_array($content['owner'])) $content['owner'] = implode(',', $content['owner']); |
|
188 | + if ($content['owner'] == '') $content['owner'] = 0; |
|
189 | 189 | if ($content['id']) |
190 | 190 | { |
191 | 191 | |
192 | - $data = $cats->id2name($content['id'],'data'); |
|
192 | + $data = $cats->id2name($content['id'], 'data'); |
|
193 | 193 | try { |
194 | 194 | $cats->edit($content); |
195 | 195 | resources_acl_bo::set_rights( |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | } |
200 | 200 | catch (Api\Exception\WrongUserinput $e) |
201 | 201 | { |
202 | - $msg = lang('Unwilling to save category with current settings. Check for inconsistency:').$e->getMessage(); // display conflicts etc. |
|
202 | + $msg = lang('Unwilling to save category with current settings. Check for inconsistency:').$e->getMessage(); // display conflicts etc. |
|
203 | 203 | } |
204 | 204 | } |
205 | 205 | else |
@@ -219,32 +219,32 @@ discard block |
||
219 | 219 | } |
220 | 220 | |
221 | 221 | $content['appname'] = 'resources'; |
222 | - if($content['data']['icon']) |
|
222 | + if ($content['data']['icon']) |
|
223 | 223 | { |
224 | - $content['icon_url'] = $content['base_url'] . $content['data']['icon']; |
|
224 | + $content['icon_url'] = $content['base_url'].$content['data']['icon']; |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | // Make sure $content['owner'] is an array otherwise it wont show up values in the multiselectbox |
228 | - if($content['owner'] == 0) |
|
228 | + if ($content['owner'] == 0) |
|
229 | 229 | { |
230 | 230 | unset($content['owner']); |
231 | 231 | } |
232 | 232 | else if (!is_array($content['owner'])) |
233 | 233 | { |
234 | - $content['owner'] = explode(',',$content['owner']); |
|
234 | + $content['owner'] = explode(',', $content['owner']); |
|
235 | 235 | } |
236 | 236 | |
237 | - foreach(self::$acl_map as $field => $acl) |
|
237 | + foreach (self::$acl_map as $field => $acl) |
|
238 | 238 | { |
239 | 239 | $content[$field] = $GLOBALS['egw']->acl->get_ids_for_location('L'.$content['id'], $acl, 'resources'); |
240 | 240 | } |
241 | 241 | |
242 | 242 | // Location |
243 | 243 | $config = Api\Config::read('resources'); |
244 | - $content['location'] = in_array($content['id'],$config['location_cats'] ? explode(',', $config['location_cats']) : array()); |
|
244 | + $content['location'] = in_array($content['id'], $config['location_cats'] ? explode(',', $config['location_cats']) : array()); |
|
245 | 245 | |
246 | 246 | $tmpl = new Etemplate('resources.acl_edit'); |
247 | - $tmpl->exec('resources.resources_acl_ui.edit',$content,$sel_options,$readonlys,$content,2); |
|
247 | + $tmpl->exec('resources.resources_acl_ui.edit', $content, $sel_options, $readonlys, $content, 2); |
|
248 | 248 | } |
249 | 249 | |
250 | 250 | function deny() |
@@ -73,7 +73,8 @@ discard block |
||
73 | 73 | $template->exec(__METHOD__, $content, $sel_options, $readonlys); |
74 | 74 | } |
75 | 75 | |
76 | - protected function get_actions($appname='resources') { |
|
76 | + protected function get_actions($appname='resources') |
|
77 | + { |
|
77 | 78 | |
78 | 79 | $actions = array( |
79 | 80 | 'open' => array( // does edit if allowed, otherwise view |
@@ -184,8 +185,14 @@ discard block |
||
184 | 185 | { |
185 | 186 | case 'save': |
186 | 187 | case 'apply': |
187 | - if(is_array($content['owner'])) $content['owner'] = implode(',',$content['owner']); |
|
188 | - if($content['owner'] == '') $content['owner'] = 0; |
|
188 | + if(is_array($content['owner'])) |
|
189 | + { |
|
190 | + $content['owner'] = implode(',',$content['owner']); |
|
191 | + } |
|
192 | + if($content['owner'] == '') |
|
193 | + { |
|
194 | + $content['owner'] = 0; |
|
195 | + } |
|
189 | 196 | if ($content['id']) |
190 | 197 | { |
191 | 198 |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | $context['appname'] = 'resources'; |
29 | 29 | |
30 | 30 | // Let parent handle the basic stuff |
31 | - parent::__construct($context,$need_reload); |
|
31 | + parent::__construct($context, $need_reload); |
|
32 | 32 | |
33 | 33 | $this->context['template'] = 'resources.show.rows'; |
34 | 34 | $this->nm_settings += array( |
@@ -48,13 +48,13 @@ discard block |
||
48 | 48 | ); |
49 | 49 | } |
50 | 50 | |
51 | - public function exec($id = null, Etemplate &$etemplate = null) |
|
51 | + public function exec($id = null, Etemplate&$etemplate = null) |
|
52 | 52 | { |
53 | 53 | $ui = new resources_ui(); |
54 | 54 | |
55 | - $this->context['sel_options']['filter']= array(''=>lang('all categories'))+(array)$ui->bo->acl->get_cats(Acl::READ); |
|
55 | + $this->context['sel_options']['filter'] = array(''=>lang('all categories')) + (array)$ui->bo->acl->get_cats(Acl::READ); |
|
56 | 56 | $this->context['sel_options']['filter2'] = resources_bo::$filter_options; |
57 | - if(!$content['nm']['filter2']) |
|
57 | + if (!$content['nm']['filter2']) |
|
58 | 58 | { |
59 | 59 | $content['nm']['filter2'] = key(resources_bo::$filter_options); |
60 | 60 | } |
@@ -92,28 +92,28 @@ discard block |
||
92 | 92 | if (!count($content['nm']['selected']) && !$content['nm']['select_all']) |
93 | 93 | { |
94 | 94 | $msg = lang('You need to select some entries first!'); |
95 | - Api\Json\Response::get()->apply('egw.message',array($msg,'error')); |
|
95 | + Api\Json\Response::get()->apply('egw.message', array($msg, 'error')); |
|
96 | 96 | } |
97 | 97 | else |
98 | 98 | { |
99 | 99 | $success = $failed = $action_msg = null; |
100 | - if ($ui->action($content['nm']['action'],$content['nm']['selected'],$content['nm']['select_all'], |
|
101 | - $success,$failed,$action_msg,'index',$msg)) |
|
100 | + if ($ui->action($content['nm']['action'], $content['nm']['selected'], $content['nm']['select_all'], |
|
101 | + $success, $failed, $action_msg, 'index', $msg)) |
|
102 | 102 | { |
103 | - $msg .= lang('%1 resource(s) %2',$success,$action_msg); |
|
103 | + $msg .= lang('%1 resource(s) %2', $success, $action_msg); |
|
104 | 104 | |
105 | - Api\Json\Response::get()->apply('egw.message',array($msg,'success')); |
|
106 | - foreach($content['nm']['selected'] as &$id) |
|
105 | + Api\Json\Response::get()->apply('egw.message', array($msg, 'success')); |
|
106 | + foreach ($content['nm']['selected'] as &$id) |
|
107 | 107 | { |
108 | 108 | $id = 'resources::'.$id; |
109 | 109 | } |
110 | 110 | // Directly request an update - this will get resources tab too |
111 | - Api\Json\Response::get()->apply('egw.dataRefreshUIDs',array($content['nm']['selected'])); |
|
111 | + Api\Json\Response::get()->apply('egw.dataRefreshUIDs', array($content['nm']['selected'])); |
|
112 | 112 | } |
113 | - elseif(empty($msg)) |
|
113 | + elseif (empty($msg)) |
|
114 | 114 | { |
115 | - $msg .= lang('%1 resource(s) %2, %3 failed because of insufficent rights !!!',$success,$action_msg,$failed); |
|
116 | - Api\Json\Response::get()->apply('egw.message',array($msg,'error')); |
|
115 | + $msg .= lang('%1 resource(s) %2, %3 failed because of insufficent rights !!!', $success, $action_msg, $failed); |
|
116 | + Api\Json\Response::get()->apply('egw.message', array($msg, 'error')); |
|
117 | 117 | } |
118 | 118 | } |
119 | 119 | } |
@@ -76,9 +76,12 @@ |
||
76 | 76 | |
77 | 77 | // This is just copy+pasted from resources_ui line 816, but we don't want |
78 | 78 | // the etemplate exec to fire again. |
79 | - if (is_array($content) && isset($content['nm']['rows']['document'])) // handle insert in default document button like an action |
|
79 | + if (is_array($content) && isset($content['nm']['rows']['document'])) |
|
80 | + { |
|
81 | + // handle insert in default document button like an action |
|
80 | 82 | { |
81 | 83 | list($id) = @each($content['nm']['rows']['document']); |
84 | + } |
|
82 | 85 | $content['nm']['action'] = 'document'; |
83 | 86 | $content['nm']['selected'] = array($id); |
84 | 87 | } |
@@ -49,7 +49,7 @@ |
||
49 | 49 | * |
50 | 50 | * @param boolean $need_reload Flag to indicate that the portlet needs to be reloaded (exec will be called) |
51 | 51 | */ |
52 | - public function __construct(Array &$context = array(), &$need_reload = false) |
|
52 | + public function __construct(array &$context = array(), &$need_reload = false) |
|
53 | 53 | { |
54 | 54 | if (false) parent::__construct(); |
55 | 55 |
@@ -26,20 +26,20 @@ |
||
26 | 26 | $this->id_field = 'res_id'; |
27 | 27 | |
28 | 28 | $this->field2history = array( |
29 | - 'res_id' => 'res_id', |
|
30 | - 'name' => 'name', |
|
31 | - 'short_description' => 'short_description', |
|
32 | - 'cat_id' => 'cat_id', |
|
33 | - 'quantity' => 'quantity', |
|
34 | - 'useable' => 'useable', |
|
35 | - 'location' => 'location', |
|
36 | - 'storage_info' => 'storage_info', |
|
37 | - 'bookable' => 'bookable', |
|
38 | - 'buyable' => 'buyable', |
|
39 | - 'prize' => 'prize', |
|
40 | - 'long_description' => 'long_description', |
|
41 | - 'inventory_number' => 'inventory_number', |
|
42 | - 'accessory_of' => 'accessory_of' |
|
29 | + 'res_id' => 'res_id', |
|
30 | + 'name' => 'name', |
|
31 | + 'short_description' => 'short_description', |
|
32 | + 'cat_id' => 'cat_id', |
|
33 | + 'quantity' => 'quantity', |
|
34 | + 'useable' => 'useable', |
|
35 | + 'location' => 'location', |
|
36 | + 'storage_info' => 'storage_info', |
|
37 | + 'bookable' => 'bookable', |
|
38 | + 'buyable' => 'buyable', |
|
39 | + 'prize' => 'prize', |
|
40 | + 'long_description' => 'long_description', |
|
41 | + 'inventory_number' => 'inventory_number', |
|
42 | + 'accessory_of' => 'accessory_of' |
|
43 | 43 | ); |
44 | 44 | parent::__construct($this->appname); |
45 | 45 | } |
@@ -21,7 +21,8 @@ |
||
21 | 21 | { |
22 | 22 | |
23 | 23 | |
24 | - public function __construct() { |
|
24 | + public function __construct() |
|
25 | + { |
|
25 | 26 | $this->appname = 'resources'; |
26 | 27 | $this->id_field = 'res_id'; |
27 | 28 |
@@ -37,8 +37,8 @@ discard block |
||
37 | 37 | function __construct() |
38 | 38 | { |
39 | 39 | // print_r($GLOBALS['egw_info']); die(); |
40 | - $this->tmpl = new Etemplate('resources.show'); |
|
41 | - $this->bo = new resources_bo(); |
|
40 | + $this->tmpl = new Etemplate('resources.show'); |
|
41 | + $this->bo = new resources_bo(); |
|
42 | 42 | // $this->calui = CreateObject('resources.ui_calviews'); |
43 | 43 | } |
44 | 44 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | * @param array $content content from eTemplate callback |
50 | 50 | * |
51 | 51 | */ |
52 | - function index($content='') |
|
52 | + function index($content = '') |
|
53 | 53 | { |
54 | 54 | if (is_array($content)) |
55 | 55 | { |
@@ -59,25 +59,25 @@ discard block |
||
59 | 59 | |
60 | 60 | if (isset($content['btn_delete_selected'])) |
61 | 61 | { |
62 | - foreach($content['nm']['rows'] as $row) |
|
62 | + foreach ($content['nm']['rows'] as $row) |
|
63 | 63 | { |
64 | - if($res_id = $row['checkbox'][0]) |
|
64 | + if ($res_id = $row['checkbox'][0]) |
|
65 | 65 | { |
66 | - $msg .= '<p>'. $this->bo->delete($res_id). '</p><br>'; |
|
66 | + $msg .= '<p>'.$this->bo->delete($res_id).'</p><br>'; |
|
67 | 67 | } |
68 | 68 | } |
69 | 69 | return $this->index($msg); |
70 | 70 | } |
71 | - foreach($content['nm']['rows'] as $row) |
|
71 | + foreach ($content['nm']['rows'] as $row) |
|
72 | 72 | { |
73 | - if(isset($row['delete'])) |
|
73 | + if (isset($row['delete'])) |
|
74 | 74 | { |
75 | - $res_id = array_search('pressed',$row['delete']); |
|
75 | + $res_id = array_search('pressed', $row['delete']); |
|
76 | 76 | return $this->index($this->bo->delete($res_id)); |
77 | 77 | } |
78 | - if(isset($row['view_acc'])) |
|
78 | + if (isset($row['view_acc'])) |
|
79 | 79 | { |
80 | - $sessiondata['filter2'] = array_search('pressed',$row['view_acc']); |
|
80 | + $sessiondata['filter2'] = array_search('pressed', $row['view_acc']); |
|
81 | 81 | Api\Cache::setSession('resources', 'index_nm', $sessiondata); |
82 | 82 | return $this->index(); |
83 | 83 | } |
@@ -90,18 +90,18 @@ discard block |
||
90 | 90 | } |
91 | 91 | else |
92 | 92 | { |
93 | - if ($this->action($content['nm']['action'],$content['nm']['selected'],$content['nm']['select_all'], |
|
94 | - $success,$failed,$action_msg,'resources_index_nm',$msg)) |
|
93 | + if ($this->action($content['nm']['action'], $content['nm']['selected'], $content['nm']['select_all'], |
|
94 | + $success, $failed, $action_msg, 'resources_index_nm', $msg)) |
|
95 | 95 | { |
96 | - $msg .= lang('%1 resource(s) %2',$success,$action_msg); |
|
96 | + $msg .= lang('%1 resource(s) %2', $success, $action_msg); |
|
97 | 97 | } |
98 | - elseif(empty($msg)) |
|
98 | + elseif (empty($msg)) |
|
99 | 99 | { |
100 | - $msg .= lang('%1 resource(s) %2, %3 failed because of insufficent rights !!!',$success,$action_msg,$failed); |
|
100 | + $msg .= lang('%1 resource(s) %2, %3 failed because of insufficent rights !!!', $success, $action_msg, $failed); |
|
101 | 101 | } |
102 | 102 | else |
103 | 103 | { |
104 | - $msg .= lang('%1 resource(s) %2, %3 failed',$success,$action_msg,$failed); |
|
104 | + $msg .= lang('%1 resource(s) %2, %3 failed', $success, $action_msg, $failed); |
|
105 | 105 | } |
106 | 106 | } |
107 | 107 | } |
@@ -111,65 +111,65 @@ discard block |
||
111 | 111 | $content = array(); |
112 | 112 | $content['msg'] = $msg ? $msg : $_GET['msg']; |
113 | 113 | |
114 | - $content['nm']['get_rows'] = 'resources.resources_bo.get_rows'; |
|
114 | + $content['nm']['get_rows'] = 'resources.resources_bo.get_rows'; |
|
115 | 115 | $content['nm']['no_filter'] = False; |
116 | 116 | $content['nm']['filter_no_lang'] = true; |
117 | 117 | $content['nm']['no_cat'] = true; |
118 | 118 | $content['nm']['bottom_too'] = true; |
119 | 119 | $content['nm']['order'] = 'name'; |
120 | - $content['nm']['sort'] = 'ASC'; |
|
121 | - $content['nm']['store_state'] = 'get_rows'; |
|
120 | + $content['nm']['sort'] = 'ASC'; |
|
121 | + $content['nm']['store_state'] = 'get_rows'; |
|
122 | 122 | $content['nm']['row_id'] = 'res_id'; |
123 | 123 | $content['nm']['favorites'] = true; |
124 | 124 | |
125 | 125 | $nm_session_data = Api\Cache::getSession('resources', 'index_nm'); |
126 | - if($nm_session_data) |
|
126 | + if ($nm_session_data) |
|
127 | 127 | { |
128 | 128 | $content['nm'] = $nm_session_data; |
129 | 129 | } |
130 | - $content['nm']['options-filter']= array(''=>lang('all categories'))+(array)$this->bo->acl->get_cats(Acl::READ); |
|
130 | + $content['nm']['options-filter'] = array(''=>lang('all categories')) + (array)$this->bo->acl->get_cats(Acl::READ); |
|
131 | 131 | $content['nm']['options-filter2'] = resources_bo::$filter_options; |
132 | - if(!$content['nm']['filter2']) |
|
132 | + if (!$content['nm']['filter2']) |
|
133 | 133 | { |
134 | 134 | $content['nm']['filter2'] = key(resources_bo::$filter_options); |
135 | 135 | } |
136 | 136 | |
137 | 137 | $config = Api\Config::read('resources'); |
138 | - if($config['history']) |
|
138 | + if ($config['history']) |
|
139 | 139 | { |
140 | 140 | $content['nm']['options-filter2'][resources_bo::DELETED] = lang('Deleted'); |
141 | 141 | } |
142 | 142 | |
143 | - if($_GET['search']) { |
|
143 | + if ($_GET['search']) { |
|
144 | 144 | $content['nm']['search'] = $_GET['search']; |
145 | 145 | } |
146 | - if($_GET['view_accs_of']) |
|
146 | + if ($_GET['view_accs_of']) |
|
147 | 147 | { |
148 | 148 | $content['nm']['filter2'] = (int)$_GET['view_accs_of']; |
149 | 149 | } |
150 | - $content['nm']['actions'] = $this->get_actions(); |
|
150 | + $content['nm']['actions'] = $this->get_actions(); |
|
151 | 151 | $content['nm']['placeholder_actions'] = array('add'); |
152 | 152 | |
153 | 153 | // check if user is permitted to add resources |
154 | 154 | // If they can't read any categories, they won't be able to save it |
155 | - if(!$this->bo->acl->get_cats(Acl::ADD) || !$this->bo->acl->get_cats(Acl::READ)) |
|
155 | + if (!$this->bo->acl->get_cats(Acl::ADD) || !$this->bo->acl->get_cats(Acl::READ)) |
|
156 | 156 | { |
157 | 157 | $no_button['add'] = $no_button['nm']['add'] = true; |
158 | 158 | } |
159 | 159 | $no_button['back'] = true; |
160 | 160 | $GLOBALS['egw_info']['flags']['app_header'] = lang('resources'); |
161 | 161 | |
162 | - Framework::includeJS('.','resources','resources'); |
|
162 | + Framework::includeJS('.', 'resources', 'resources'); |
|
163 | 163 | |
164 | - if($content['nm']['filter2'] > 0) |
|
164 | + if ($content['nm']['filter2'] > 0) |
|
165 | 165 | { |
166 | 166 | $master = $this->bo->so->read(array('res_id' => $content['nm']['filter2'])); |
167 | 167 | $content['nm']['options-filter2'] = resources_bo::$filter_options + array( |
168 | - $master['res_id'] => lang('accessories of') . ' ' . $master['name'] |
|
168 | + $master['res_id'] => lang('accessories of').' '.$master['name'] |
|
169 | 169 | ); |
170 | - $content['nm']['get_rows'] = 'resources.resources_bo.get_rows'; |
|
171 | - $GLOBALS['egw_info']['flags']['app_header'] = lang('resources') . ' - ' . lang('accessories of '). ' '. $master['name'] . |
|
172 | - ($master['short_description'] ? ' [' . $master['short_description'] . ']' : ''); |
|
170 | + $content['nm']['get_rows'] = 'resources.resources_bo.get_rows'; |
|
171 | + $GLOBALS['egw_info']['flags']['app_header'] = lang('resources').' - '.lang('accessories of ').' '.$master['name']. |
|
172 | + ($master['short_description'] ? ' ['.$master['short_description'].']' : ''); |
|
173 | 173 | } |
174 | 174 | $preserv = $content; |
175 | 175 | |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | |
178 | 178 | Api\Cache::setSession('resources', 'index_nm', $content['nm']); |
179 | 179 | $this->tmpl->read('resources.show'); |
180 | - return $this->tmpl->exec('resources.resources_ui.index',$content,$sel_options,$no_button,$preserv); |
|
180 | + return $this->tmpl->exec('resources.resources_ui.index', $content, $sel_options, $no_button, $preserv); |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | /** |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | 'allowOnMultiple' => false, |
195 | 195 | 'url' => 'menuaction=resources.resources_ui.edit&res_id=$id', |
196 | 196 | 'popup' => Link::get_registry('resources', 'add_popup'), |
197 | - 'group' => $group=1, |
|
197 | + 'group' => $group = 1, |
|
198 | 198 | 'disableClass' => 'rowNoEdit', |
199 | 199 | ), |
200 | 200 | 'add' => array( |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | * @param string/array $session_name 'index' or 'email', or array with session-data depending if we are in the main list or the popup |
277 | 277 | * @return boolean true if all actions succeded, false otherwise |
278 | 278 | */ |
279 | - function action($action,$checked,$use_all,&$success,&$failed,&$action_msg,$session_name,&$msg) |
|
279 | + function action($action, $checked, $use_all, &$success, &$failed, &$action_msg, $session_name, &$msg) |
|
280 | 280 | { |
281 | 281 | $success = $failed = 0; |
282 | 282 | if ($use_all) |
@@ -284,11 +284,11 @@ discard block |
||
284 | 284 | // get the whole selection |
285 | 285 | $query = is_array($session_name) ? $session_name : $GLOBALS['egw']->session->appsession('session_data', $session_name); |
286 | 286 | |
287 | - @set_time_limit(0); // switch off the execution time limit, as it's for big selections to small |
|
288 | - $query['num_rows'] = -1; // all |
|
289 | - $this->bo->get_rows($query,$resources,$readonlys); |
|
287 | + @set_time_limit(0); // switch off the execution time limit, as it's for big selections to small |
|
288 | + $query['num_rows'] = -1; // all |
|
289 | + $this->bo->get_rows($query, $resources, $readonlys); |
|
290 | 290 | $checked = array(); |
291 | - foreach($resources as $resource) |
|
291 | + foreach ($resources as $resource) |
|
292 | 292 | { |
293 | 293 | $checked[] = $resource['res_id']; |
294 | 294 | } |
@@ -298,17 +298,17 @@ discard block |
||
298 | 298 | // Dialogs to get options |
299 | 299 | list($action, $settings) = explode('_', $action, 2); |
300 | 300 | |
301 | - switch($action) |
|
301 | + switch ($action) |
|
302 | 302 | { |
303 | 303 | case 'restore': |
304 | 304 | $action_msg = lang('restored'); |
305 | - foreach($checked as $n=>$id) |
|
305 | + foreach ($checked as $n=>$id) |
|
306 | 306 | { |
307 | 307 | // Extra data |
308 | - if(!$id) continue; |
|
308 | + if (!$id) continue; |
|
309 | 309 | $resource = $this->bo->read($id); |
310 | 310 | $resource['deleted'] = null; |
311 | - if($resource['accessory_of'] > 0) |
|
311 | + if ($resource['accessory_of'] > 0) |
|
312 | 312 | { |
313 | 313 | /* |
314 | 314 | If restoring an accessory, and parent is deleted, and not in |
@@ -316,18 +316,18 @@ discard block |
||
316 | 316 | */ |
317 | 317 | $parent = $this->bo->read($resource['accessory_of']); |
318 | 318 | $checked_key = array_search($parent['res_id'], $checked); |
319 | - if($checked_key === false && $parent['deleted']) |
|
319 | + if ($checked_key === false && $parent['deleted']) |
|
320 | 320 | { |
321 | 321 | $resource['accessory_of'] = -1; |
322 | 322 | } |
323 | 323 | } |
324 | 324 | |
325 | 325 | $this->bo->save($resource); |
326 | - if($settings == 'accessories') |
|
326 | + if ($settings == 'accessories') |
|
327 | 327 | { |
328 | 328 | // Restore accessories too |
329 | - $accessories = $this->bo->get_acc_list($id,true); |
|
330 | - foreach($accessories as $acc_id => $name) |
|
329 | + $accessories = $this->bo->get_acc_list($id, true); |
|
330 | + foreach ($accessories as $acc_id => $name) |
|
331 | 331 | { |
332 | 332 | $acc = $this->bo->read($acc_id); |
333 | 333 | $acc['deleted'] = null; |
@@ -337,20 +337,20 @@ discard block |
||
337 | 337 | } |
338 | 338 | $success++; |
339 | 339 | } |
340 | - if($restored_accessories) $action_msg .= ", " . lang('%1 accessories restored',$restored_accessories); |
|
340 | + if ($restored_accessories) $action_msg .= ", ".lang('%1 accessories restored', $restored_accessories); |
|
341 | 341 | break; |
342 | 342 | case 'delete': |
343 | 343 | $action_msg = lang('deleted'); |
344 | 344 | $promoted_accessories = 0; |
345 | - foreach($checked as $n => &$id) |
|
345 | + foreach ($checked as $n => &$id) |
|
346 | 346 | { |
347 | 347 | // Extra data |
348 | - if(!$id) continue; |
|
348 | + if (!$id) continue; |
|
349 | 349 | $resource = $this->bo->read($id); |
350 | - if($settings == 'promote') |
|
350 | + if ($settings == 'promote') |
|
351 | 351 | { |
352 | 352 | // Handle a selected accessory |
353 | - if($resource['accessory_of'] > 0) |
|
353 | + if ($resource['accessory_of'] > 0) |
|
354 | 354 | { |
355 | 355 | $resource['accessory_of'] = -1; |
356 | 356 | $this->bo->save($resource); |
@@ -359,8 +359,8 @@ discard block |
||
359 | 359 | } |
360 | 360 | |
361 | 361 | // Make associated accessories into resources - include deleted |
362 | - $accessories = $this->bo->get_acc_list($id,true); |
|
363 | - foreach($accessories as $acc_id => $name) |
|
362 | + $accessories = $this->bo->get_acc_list($id, true); |
|
363 | + foreach ($accessories as $acc_id => $name) |
|
364 | 364 | { |
365 | 365 | $acc = $this->bo->read($acc_id); |
366 | 366 | $acc['accessory_of'] = -1; |
@@ -371,19 +371,19 @@ discard block |
||
371 | 371 | |
372 | 372 | // Don't need to process these ones now |
373 | 373 | $checked_key = array_search($acc_id, $checked); |
374 | - if($checked_key !== false) unset($checked[$checked_key]); |
|
374 | + if ($checked_key !== false) unset($checked[$checked_key]); |
|
375 | 375 | } |
376 | 376 | } |
377 | 377 | else |
378 | 378 | { |
379 | 379 | // Remove checked accessories, deleting resource will remove them |
380 | 380 | // We get an error if we try to delete them after they're gone |
381 | - $accessories = $this->bo->get_acc_list($id,$resource['deleted']); |
|
381 | + $accessories = $this->bo->get_acc_list($id, $resource['deleted']); |
|
382 | 382 | |
383 | - foreach($accessories as $acc_id => $name) |
|
383 | + foreach ($accessories as $acc_id => $name) |
|
384 | 384 | { |
385 | 385 | $checked_key = array_search($acc_id, $checked); |
386 | - if($checked_key !== false) |
|
386 | + if ($checked_key !== false) |
|
387 | 387 | { |
388 | 388 | $success++; |
389 | 389 | unset($checked[$checked_key]); |
@@ -397,11 +397,11 @@ discard block |
||
397 | 397 | } |
398 | 398 | else |
399 | 399 | { |
400 | - $msg = $error . "\n"; |
|
400 | + $msg = $error."\n"; |
|
401 | 401 | $failed++; |
402 | 402 | } |
403 | 403 | } |
404 | - if($promoted_accessories) $action_msg .= ", " . lang('%1 accessories now resources',$promoted_accessories); |
|
404 | + if ($promoted_accessories) $action_msg .= ", ".lang('%1 accessories now resources', $promoted_accessories); |
|
405 | 405 | break; |
406 | 406 | } |
407 | 407 | return $failed == 0; |
@@ -413,13 +413,13 @@ discard block |
||
413 | 413 | * |
414 | 414 | * @param $content Content from the eTemplate Exec call or id on inital call |
415 | 415 | */ |
416 | - function edit($content=0,$accessory_of = -1) |
|
416 | + function edit($content = 0, $accessory_of = -1) |
|
417 | 417 | { |
418 | 418 | if (is_array($content)) |
419 | 419 | { |
420 | 420 | list($button) = @each($content['button']); |
421 | 421 | unset($content['button']); |
422 | - switch($button) |
|
422 | + switch ($button) |
|
423 | 423 | { |
424 | 424 | case 'save': |
425 | 425 | case 'apply': |
@@ -430,20 +430,20 @@ discard block |
||
430 | 430 | // // links are already saved by eTemplate |
431 | 431 | // unset($resource['link_to']['to_id']); |
432 | 432 | // } |
433 | - if($content['res_id']) |
|
433 | + if ($content['res_id']) |
|
434 | 434 | { |
435 | 435 | $acc_count = count($this->bo->get_acc_list($content['res_id'])); |
436 | 436 | } |
437 | 437 | $result = $this->bo->save($content); |
438 | 438 | |
439 | - if(is_numeric($result)) |
|
439 | + if (is_numeric($result)) |
|
440 | 440 | { |
441 | - $msg = lang('Resource %1 saved!',$result); |
|
441 | + $msg = lang('Resource %1 saved!', $result); |
|
442 | 442 | $content['res_id'] = $result; |
443 | - if($acc_count && $content['accessory_of'] != -1) |
|
443 | + if ($acc_count && $content['accessory_of'] != -1) |
|
444 | 444 | { |
445 | 445 | // Resource with accessories changed into accessory |
446 | - if($acc_count) $msg = lang('%1 accessories now resources',$acc_count); |
|
446 | + if ($acc_count) $msg = lang('%1 accessories now resources', $acc_count); |
|
447 | 447 | } |
448 | 448 | } |
449 | 449 | else |
@@ -454,9 +454,9 @@ discard block |
||
454 | 454 | break; |
455 | 455 | case 'delete': |
456 | 456 | unset($content['delete']); |
457 | - if(!$this->bo->delete($content['res_id'])) |
|
457 | + if (!$this->bo->delete($content['res_id'])) |
|
458 | 458 | { |
459 | - $msg = lang('Resource %1 deleted!',$content['res_id']); |
|
459 | + $msg = lang('Resource %1 deleted!', $content['res_id']); |
|
460 | 460 | } |
461 | 461 | else |
462 | 462 | { |
@@ -464,9 +464,9 @@ discard block |
||
464 | 464 | break; |
465 | 465 | } |
466 | 466 | } |
467 | - Framework::refresh_opener($msg, 'resources',$content['res_id'],($button == 'delete'?'delete':'edit')); |
|
467 | + Framework::refresh_opener($msg, 'resources', $content['res_id'], ($button == 'delete' ? 'delete' : 'edit')); |
|
468 | 468 | |
469 | - if($button != 'apply') |
|
469 | + if ($button != 'apply') |
|
470 | 470 | { |
471 | 471 | Framework::window_close(); |
472 | 472 | } |
@@ -482,7 +482,7 @@ discard block |
||
482 | 482 | if ($res_id > 0) |
483 | 483 | { |
484 | 484 | $content = $this->bo->read($res_id); |
485 | - $content['picture_src'] = strpos($content['picture_src'],'.') !== false ? 'gen_src' : $content['picture_src']; |
|
485 | + $content['picture_src'] = strpos($content['picture_src'], '.') !== false ? 'gen_src' : $content['picture_src']; |
|
486 | 486 | $content['link_to'] = array( |
487 | 487 | 'to_id' => $res_id, |
488 | 488 | 'to_app' => 'resources' |
@@ -490,7 +490,7 @@ discard block |
||
490 | 490 | } elseif ($accessory_of > 0) { |
491 | 491 | // Pre-set according to parent |
492 | 492 | $owner = $this->bo->read($accessory_of); |
493 | - if($owner['accessory_of'] > 0) |
|
493 | + if ($owner['accessory_of'] > 0) |
|
494 | 494 | { |
495 | 495 | // Accessory of accessory not allowed, grab parent resource |
496 | 496 | $accessory_of = $owner['accessory_of']; |
@@ -503,33 +503,32 @@ discard block |
||
503 | 503 | $content['cat_id'] = $nm_session_data['filter']; |
504 | 504 | $content['bookable'] = true; |
505 | 505 | } |
506 | - if($msg) { |
|
506 | + if ($msg) { |
|
507 | 507 | $content['msg'] = $msg; |
508 | 508 | } |
509 | 509 | |
510 | 510 | if ($_GET['msg']) $content['msg'] = strip_tags($_GET['msg']); |
511 | 511 | |
512 | 512 | // some presetes |
513 | - $content['resource_picture'] = $this->bo->get_picture($content['res_id'],false); |
|
513 | + $content['resource_picture'] = $this->bo->get_picture($content['res_id'], false); |
|
514 | 514 | // Set original size picture |
515 | - $content['picture_original'] = $content['picture_src'] == 'own_src'? |
|
516 | - 'webdav.php/apps/resources/'.$content['res_id'].'/.picture.jpg': $this->bo->get_picture($content['res_id'],true); |
|
515 | + $content['picture_original'] = $content['picture_src'] == 'own_src' ? |
|
516 | + 'webdav.php/apps/resources/'.$content['res_id'].'/.picture.jpg' : $this->bo->get_picture($content['res_id'], true); |
|
517 | 517 | |
518 | 518 | $content['quantity'] = $content['quantity'] ? $content['quantity'] : 1; |
519 | 519 | $content['useable'] = $content['useable'] ? $content['useable'] : 1; |
520 | 520 | $content['accessory_of'] = $content['accessory_of'] ? $content['accessory_of'] : $accessory_of; |
521 | 521 | |
522 | - if($content['res_id'] && $content['accessory_of'] == -1) |
|
522 | + if ($content['res_id'] && $content['accessory_of'] == -1) |
|
523 | 523 | { |
524 | 524 | $content['acc_count'] = count($this->bo->get_acc_list($content['res_id'])); |
525 | 525 | } |
526 | 526 | $sel_options['status'] = resources_bo::$field2label; |
527 | 527 | |
528 | 528 | //$sel_options['gen_src_list'] = $this->bo->get_genpicturelist(); |
529 | - $sel_options['cat_id'] = $this->bo->acl->get_cats(Acl::ADD); |
|
530 | - $sel_options['cat_id'] = count($sel_options['cat_id']) == 1 ? $sel_options['cat_id'] : |
|
531 | - array('' => lang('select one')) + $sel_options['cat_id']; |
|
532 | - if($accessory_of > 0 || $content['accessory_of'] > 0) |
|
529 | + $sel_options['cat_id'] = $this->bo->acl->get_cats(Acl::ADD); |
|
530 | + $sel_options['cat_id'] = count($sel_options['cat_id']) == 1 ? $sel_options['cat_id'] : array('' => lang('select one')) + $sel_options['cat_id']; |
|
531 | + if ($accessory_of > 0 || $content['accessory_of'] > 0) |
|
533 | 532 | { |
534 | 533 | $content['accessory_of'] = $content['accessory_of'] ? $content['accessory_of'] : $accessory_of; |
535 | 534 | } |
@@ -544,19 +543,19 @@ discard block |
||
544 | 543 | ) |
545 | 544 | ); |
546 | 545 | |
547 | - $sel_options['accessory_of'] = array(-1 => lang('none')) + (array)$this->bo->link_query('',$search_options); |
|
548 | - if($res_id) unset($sel_options['accessory_of'][$res_id]); |
|
546 | + $sel_options['accessory_of'] = array(-1 => lang('none')) + (array)$this->bo->link_query('', $search_options); |
|
547 | + if ($res_id) unset($sel_options['accessory_of'][$res_id]); |
|
549 | 548 | |
550 | 549 | // $content['general|page|pictures|links'] = 'resources.edit_tabs.page'; //debug |
551 | 550 | |
552 | 551 | // Permissions |
553 | 552 | $read_only = array(); |
554 | - if($res_id && !$this->bo->acl->is_permitted($content['cat_id'],Acl::EDIT)) |
|
553 | + if ($res_id && !$this->bo->acl->is_permitted($content['cat_id'], Acl::EDIT)) |
|
555 | 554 | { |
556 | 555 | $read_only['__ALL__'] = true; |
557 | 556 | } |
558 | 557 | $config = Api\Config::read('resources'); |
559 | - if(!$this->bo->acl->is_permitted($content['cat_id'],Acl::DELETE) || |
|
558 | + if (!$this->bo->acl->is_permitted($content['cat_id'], Acl::DELETE) || |
|
560 | 559 | ($content['deleted'] && !$GLOBALS['egw_info']['user']['apps']['admin'] && $config['history'] == 'history')) |
561 | 560 | { |
562 | 561 | $read_only['delete'] = true; |
@@ -564,19 +563,19 @@ discard block |
||
564 | 563 | |
565 | 564 | // Can't make a resource with accessories an accessory |
566 | 565 | $read_only['accessory_of'] = $content['acc_count']; |
567 | - if($read_only['accessory_of']) |
|
566 | + if ($read_only['accessory_of']) |
|
568 | 567 | { |
569 | 568 | $content['accessory_label'] = lang('Remove accessories before changing Accessory of'); |
570 | 569 | } |
571 | 570 | |
572 | 571 | // Disable custom tab if there are no custom fields defined |
573 | - $read_only['tabs']['custom'] = !(Api\Storage\Customfields::get('resources',true)); |
|
574 | - $read_only['tabs']['history'] = ($content['history']['id'] != 0?false:true); |
|
572 | + $read_only['tabs']['custom'] = !(Api\Storage\Customfields::get('resources', true)); |
|
573 | + $read_only['tabs']['history'] = ($content['history']['id'] != 0 ? false : true); |
|
575 | 574 | |
576 | 575 | $preserv = $content; |
577 | 576 | |
578 | 577 | $this->tmpl->read('resources.edit'); |
579 | - return $this->tmpl->exec('resources.resources_ui.edit',$content,$sel_options,$read_only,$preserv,2); |
|
578 | + return $this->tmpl->exec('resources.resources_ui.edit', $content, $sel_options, $read_only, $preserv, 2); |
|
580 | 579 | } |
581 | 580 | |
582 | 581 | } |
@@ -1053,7 +1053,7 @@ |
||
1053 | 1053 | * @param int &$success number of succeded actions |
1054 | 1054 | * @param int &$failed number of failed actions (not enought permissions) |
1055 | 1055 | * @param string &$action_msg translated verb for the actions, to be used in a message like %1 timesheets 'deleted' |
1056 | - * @param string/array $session_name 'index' or 'email', or array with session-data depending if we are in the main list or the popup |
|
1056 | + * @param string $session_name 'index' or 'email', or array with session-data depending if we are in the main list or the popup |
|
1057 | 1057 | * @return boolean true if all actions succeded, false otherwise |
1058 | 1058 | */ |
1059 | 1059 | function action($action,$checked,$use_all,&$success,&$failed,&$action_msg,$session_name,&$msg) |
@@ -105,7 +105,9 @@ discard block |
||
105 | 105 | } |
106 | 106 | } |
107 | 107 | } |
108 | - } else { |
|
108 | + } |
|
109 | + else |
|
110 | + { |
|
109 | 111 | $msg = $content; |
110 | 112 | } |
111 | 113 | $content = array(); |
@@ -140,7 +142,8 @@ discard block |
||
140 | 142 | $content['nm']['options-filter2'][resources_bo::DELETED] = lang('Deleted'); |
141 | 143 | } |
142 | 144 | |
143 | - if($_GET['search']) { |
|
145 | + if($_GET['search']) |
|
146 | + { |
|
144 | 147 | $content['nm']['search'] = $_GET['search']; |
145 | 148 | } |
146 | 149 | if($_GET['view_accs_of']) |
@@ -305,7 +308,10 @@ discard block |
||
305 | 308 | foreach($checked as $n=>$id) |
306 | 309 | { |
307 | 310 | // Extra data |
308 | - if(!$id) continue; |
|
311 | + if(!$id) |
|
312 | + { |
|
313 | + continue; |
|
314 | + } |
|
309 | 315 | $resource = $this->bo->read($id); |
310 | 316 | $resource['deleted'] = null; |
311 | 317 | if($resource['accessory_of'] > 0) |
@@ -337,7 +343,10 @@ discard block |
||
337 | 343 | } |
338 | 344 | $success++; |
339 | 345 | } |
340 | - if($restored_accessories) $action_msg .= ", " . lang('%1 accessories restored',$restored_accessories); |
|
346 | + if($restored_accessories) |
|
347 | + { |
|
348 | + $action_msg .= ", " . lang('%1 accessories restored',$restored_accessories); |
|
349 | + } |
|
341 | 350 | break; |
342 | 351 | case 'delete': |
343 | 352 | $action_msg = lang('deleted'); |
@@ -345,7 +354,10 @@ discard block |
||
345 | 354 | foreach($checked as $n => &$id) |
346 | 355 | { |
347 | 356 | // Extra data |
348 | - if(!$id) continue; |
|
357 | + if(!$id) |
|
358 | + { |
|
359 | + continue; |
|
360 | + } |
|
349 | 361 | $resource = $this->bo->read($id); |
350 | 362 | if($settings == 'promote') |
351 | 363 | { |
@@ -371,7 +383,10 @@ discard block |
||
371 | 383 | |
372 | 384 | // Don't need to process these ones now |
373 | 385 | $checked_key = array_search($acc_id, $checked); |
374 | - if($checked_key !== false) unset($checked[$checked_key]); |
|
386 | + if($checked_key !== false) |
|
387 | + { |
|
388 | + unset($checked[$checked_key]); |
|
389 | + } |
|
375 | 390 | } |
376 | 391 | } |
377 | 392 | else |
@@ -401,7 +416,10 @@ discard block |
||
401 | 416 | $failed++; |
402 | 417 | } |
403 | 418 | } |
404 | - if($promoted_accessories) $action_msg .= ", " . lang('%1 accessories now resources',$promoted_accessories); |
|
419 | + if($promoted_accessories) |
|
420 | + { |
|
421 | + $action_msg .= ", " . lang('%1 accessories now resources',$promoted_accessories); |
|
422 | + } |
|
405 | 423 | break; |
406 | 424 | } |
407 | 425 | return $failed == 0; |
@@ -443,7 +461,10 @@ discard block |
||
443 | 461 | if($acc_count && $content['accessory_of'] != -1) |
444 | 462 | { |
445 | 463 | // Resource with accessories changed into accessory |
446 | - if($acc_count) $msg = lang('%1 accessories now resources',$acc_count); |
|
464 | + if($acc_count) |
|
465 | + { |
|
466 | + $msg = lang('%1 accessories now resources',$acc_count); |
|
467 | + } |
|
447 | 468 | } |
448 | 469 | } |
449 | 470 | else |
@@ -475,9 +496,18 @@ discard block |
||
475 | 496 | |
476 | 497 | $nm_session_data = Api\Cache::getSession('resources', 'index_nm'); |
477 | 498 | $res_id = is_numeric($content) ? (int)$content : $content['res_id']; |
478 | - if (isset($_GET['res_id'])) $res_id = $_GET['res_id']; |
|
479 | - if (isset($nm_session_data['filter2']) && $nm_session_data['filter2'] > 0) $accessory_of = $nm_session_data['filter2']; |
|
480 | - if (isset($_GET['accessory_of'])) $accessory_of = $_GET['accessory_of']; |
|
499 | + if (isset($_GET['res_id'])) |
|
500 | + { |
|
501 | + $res_id = $_GET['res_id']; |
|
502 | + } |
|
503 | + if (isset($nm_session_data['filter2']) && $nm_session_data['filter2'] > 0) |
|
504 | + { |
|
505 | + $accessory_of = $nm_session_data['filter2']; |
|
506 | + } |
|
507 | + if (isset($_GET['accessory_of'])) |
|
508 | + { |
|
509 | + $accessory_of = $_GET['accessory_of']; |
|
510 | + } |
|
481 | 511 | $content = array('res_id' => $res_id); |
482 | 512 | if ($res_id > 0) |
483 | 513 | { |
@@ -487,7 +517,9 @@ discard block |
||
487 | 517 | 'to_id' => $res_id, |
488 | 518 | 'to_app' => 'resources' |
489 | 519 | ); |
490 | - } elseif ($accessory_of > 0) { |
|
520 | + } |
|
521 | + elseif ($accessory_of > 0) |
|
522 | + { |
|
491 | 523 | // Pre-set according to parent |
492 | 524 | $owner = $this->bo->read($accessory_of); |
493 | 525 | if($owner['accessory_of'] > 0) |
@@ -498,16 +530,22 @@ discard block |
||
498 | 530 | } |
499 | 531 | $content['cat_id'] = $owner['cat_id']; |
500 | 532 | $content['bookable'] = true; |
501 | - } else { |
|
533 | + } |
|
534 | + else |
|
535 | + { |
|
502 | 536 | // New resource |
503 | 537 | $content['cat_id'] = $nm_session_data['filter']; |
504 | 538 | $content['bookable'] = true; |
505 | 539 | } |
506 | - if($msg) { |
|
540 | + if($msg) |
|
541 | + { |
|
507 | 542 | $content['msg'] = $msg; |
508 | 543 | } |
509 | 544 | |
510 | - if ($_GET['msg']) $content['msg'] = strip_tags($_GET['msg']); |
|
545 | + if ($_GET['msg']) |
|
546 | + { |
|
547 | + $content['msg'] = strip_tags($_GET['msg']); |
|
548 | + } |
|
511 | 549 | |
512 | 550 | // some presetes |
513 | 551 | $content['resource_picture'] = $this->bo->get_picture($content['res_id'],false); |
@@ -545,7 +583,10 @@ discard block |
||
545 | 583 | ); |
546 | 584 | |
547 | 585 | $sel_options['accessory_of'] = array(-1 => lang('none')) + (array)$this->bo->link_query('',$search_options); |
548 | - if($res_id) unset($sel_options['accessory_of'][$res_id]); |
|
586 | + if($res_id) |
|
587 | + { |
|
588 | + unset($sel_options['accessory_of'][$res_id]); |
|
589 | + } |
|
549 | 590 | |
550 | 591 | // $content['general|page|pictures|links'] = 'resources.edit_tabs.page'; //debug |
551 | 592 |