@@ -20,7 +20,11 @@ function os2web_borger_dk_settings_form($form, $form_state) {
20
20
'#group ' => 'vertical_settings_tab ' ,
21
21
);
22
22
// Some of the fields are locked from from being changed.
23
- $ locked_os2web_types = array ('field_os2web_borger_dk_borgerurl ' => 1 , 'field_termref_kle ' => 2 , 'field_os2web_borger_dk_formterm ' => 2 );
23
+ $ locked_os2web_types = array (
24
+ 'field_os2web_borger_dk_borgerurl ' => 1 ,
25
+ 'field_os2web_borger_dk_kle ' => 2 ,
26
+ 'field_os2web_borger_dk_formterm ' => 2 ,
27
+ );
24
28
25
29
$ data = field_info_instances ('node ' , 'os2web_borger_dk_article ' );
26
30
$ newdata = array ();
@@ -35,7 +39,7 @@ function os2web_borger_dk_settings_form($form, $form_state) {
35
39
}
36
40
if (empty ($ locked_os2web_types [$ type ]) || (!empty ($ locked_os2web_types [$ type ]) && $ locked_os2web_types [$ type ] == 1 )) {
37
41
// Only some of the locked types can be displayed.
38
- $ newdata [$ type ] = t ( $ item ['label ' ]) ;
42
+ $ newdata [$ type ] = $ item ['label ' ];
39
43
$ init [$ type ] = $ type ;
40
44
}
41
45
}
@@ -189,7 +193,7 @@ function os2web_borger_dk_settings_form($form, $form_state) {
189
193
'#description' => t('Check to enable weekly menu-import from Borger.dk (otherwise menus are imported daily)'),
190
194
'#default_value' => variable_get('os2web_borger_dk_weekly_borger_dk_menus_import', 0),
191
195
);*/
192
- $ form ['os2web_borger_dk_settings_6 ' ]['os2web_borger_dk_menu_import_description ' ]= array (
196
+ $ form ['os2web_borger_dk_settings_6 ' ]['os2web_borger_dk_menu_import_description ' ] = array (
193
197
'#type ' => 'fieldset ' ,
194
198
'#title ' => t ('Description for importing Borger.dk menu structure ' ),
195
199
'#description ' => t ("Before you import Borger.dk menu structure, please create a content type
@@ -198,7 +202,7 @@ function os2web_borger_dk_settings_form($form, $form_state) {
198
202
Step2 : When Borger.dk menu items are imported, please import all Borger.dk articles.
199
203
Step 3 : Create Borger.dk menu structure now. " ),
200
204
);
201
- $ menu_option = array ();
205
+ $ menu_option = array ();
202
206
$ existing_menu = db_query ('SELECT * FROM {menu_custom} ' );
203
207
$ menu_option ['borgerdkmenu2 ' ] = variable_get ('os2web_borger_dk_borger_dk_menu_name ' , 'Borger.dk menu ' );
204
208
if ($ existing_menu ) {
@@ -213,10 +217,10 @@ function os2web_borger_dk_settings_form($form, $form_state) {
213
217
'#title ' => t ('Select Borger.dk menu Parent Item ' ),
214
218
'#options ' => $ menu_option ,
215
219
'#description ' => t ('Select Borger.dk menu Parent Item from the list. REMEMBER to save before you start Menu import. ' ),
216
- '#default_value ' => variable_get ('build_borger_menu_under_menu ' ,'borgerdkmenu2 ' ),
220
+ '#default_value ' => variable_get ('build_borger_menu_under_menu ' , 'borgerdkmenu2 ' ),
217
221
'#type ' => 'select ' ,
218
222
);
219
- //variable_set('build_borger_menu_under_menu');
223
+ // variable_set('build_borger_menu_under_menu');
220
224
221
225
$ disabled = FALSE ;
222
226
$ description = '' ;
@@ -226,7 +230,7 @@ function os2web_borger_dk_settings_form($form, $form_state) {
226
230
$ description = t ('If you want to import the Borger.dk menu you must first activate "Import and utilize Borger.dk-menus" and save the settings ' );
227
231
drupal_set_message ($ description );
228
232
}
229
- $ form ['os2web_borger_dk_settings_6 ' ]['submit ' ]= array (
233
+ $ form ['os2web_borger_dk_settings_6 ' ]['submit ' ] = array (
230
234
'#type ' => 'submit ' ,
231
235
'#value ' => 'Import Borger.dk-menu now ' ,
232
236
'#submit ' => array ('os2web_borger_dk_import_menu_now_form_submit ' ),
@@ -239,9 +243,9 @@ function os2web_borger_dk_settings_form($form, $form_state) {
239
243
'#value ' => 'Import Borger.dk articles ' ,
240
244
'#submit ' => array ('os2web_borger_dk_import_articles_now_form_submit ' ),
241
245
'#disabled ' => $ disabled ,
242
- '#description ' => t (' Step2 : When Borger.dk menu items are imported, please import all Borger.dk articles. ' ),
246
+ '#description ' => t ('Step2 : When Borger.dk menu items are imported, please import all Borger.dk articles. ' ),
243
247
);
244
- $ form ['os2web_borger_dk_settings_6 ' ]['create_borger_dk_menu_links ' ] = array (
248
+ $ form ['os2web_borger_dk_settings_6 ' ]['create_borger_dk_menu_links ' ] = array (
245
249
'#type ' => 'submit ' ,
246
250
'#value ' => t ('Create Borger.dk menu structure now ' ),
247
251
'#submit ' => array ('os2web_borger_dk_create_borger_dk_menu_now_form_submit ' ),
@@ -258,16 +262,16 @@ function os2web_borger_dk_settings_form($form, $form_state) {
258
262
$ form ['os2web_borger_dk_settings_7 ' ]['os2web_borger_dk_microarticle_active ' ] = array (
259
263
'#type ' => 'checkbox ' ,
260
264
'#title ' => t ('Show and edit microarticles individually ' ),
261
- '#description ' => t ('Check to enable visibility and editablity of microarticles from Borger.dk ' ),
265
+ '#description ' => t ('Check to enable visibility and editablity of microarticles from Borger.dk ' ),
262
266
'#default_value ' => variable_get ('os2web_borger_dk_microarticle_active ' , 0 ),
263
267
);
264
268
265
269
$ options = variable_get ('os2web_borger_dk_municipality_list ' );
266
270
if (isset ($ options )) {
267
- $ muni_items = $ options ;
271
+ $ muni_items = $ options ;
268
272
}
269
- else {
270
- $ muni_items = array ();
273
+ else {
274
+ $ muni_items = array ();
271
275
$ municipalities = _os2web_borger_dk_GetMunicipalityList ();
272
276
$ muni_items [0 ] = t ('--Not selected-- ' );
273
277
foreach ($ municipalities as $ code => $ item ) {
@@ -290,23 +294,25 @@ function os2web_borger_dk_settings_form($form, $form_state) {
290
294
'#options ' => $ muni_items ,
291
295
'#description ' => t ('Check to import articles from Borger.dk according to municipality. ' ),
292
296
'#default_value ' => $ admin_municipality ,
293
- );
297
+ );
294
298
return system_settings_form ($ form );
295
299
}
296
300
297
301
/**
298
- * Function _os2web_borger_dk_GetMunicipalityList()
302
+ * Function _os2web_borger_dk_GetMunicipalityList().
303
+ *
299
304
* This function uses the Borger.dk Webservice GetMunicipalityList
300
305
* in order to fetch a list of Municipality-codes from Borger.dk
301
306
*/
302
307
function _os2web_borger_dk_GetMunicipalityList ($ wsdl = 'https://www.borger.dk/_vti_bin/borger/ArticleExport.svc?wsdl ' ) {
303
308
$ errors = array ();
304
309
$ municipality_item = array ();
305
310
306
- // Then we can start using a new soap-client to find the article-ID from the Borger.dk-URL
311
+ // Then we can start using a new soap-client to
312
+ // find the article-ID from the Borger.dk-URL.
307
313
$ client = new SoapClient ($ wsdl , array ('exceptions ' => 0 ));
308
314
// First we make sure to keep requests/minute within given limits.
309
- //_os2web_borger_dk_articles_check_webservice_constraints();
315
+ // _os2web_borger_dk_articles_check_webservice_constraints();
310
316
// Then we execute our webservice-request.
311
317
$ result_list = $ client ->GetMunicipalityList ();
312
318
if (is_soap_fault ($ result_list )) {
@@ -315,15 +321,14 @@ function _os2web_borger_dk_GetMunicipalityList($wsdl = 'https://www.borger.dk/_v
315
321
}
316
322
317
323
$ municipality_item = array ();
318
- // Then we get the result-list from the specified webservice
324
+ // Then we get the result-list from the specified webservice.
319
325
$ municipality_list = $ result_list ->GetMunicipalityListResult ;
320
326
if (is_soap_fault ($ municipality_list )) {
321
327
$ errors = _os2web_borger_dk_articles_translate_soap_fault ('GetMunicipalityListResult ' , $ municipality_list ->faultcode , $ municipality_list ->faultstring );
322
328
323
329
return $ errors ;
324
330
}
325
331
else {
326
- //print 'GetAllSites found these availlable menu-items at Borger.dk: '. print_r($municipality_list, TRUE) ."\n\n";
327
332
// Now we step through all the fetched menu-items and convert them to
328
333
// arrays of wanted field-sets.
329
334
if (is_array ($ municipality_list ->Municipality )) {
@@ -342,6 +347,8 @@ function _os2web_borger_dk_GetMunicipalityList($wsdl = 'https://www.borger.dk/_v
342
347
}
343
348
344
349
/**
350
+ * Function _os2web_borger_dk_articles_parse_borgerdk_municipality_item().
351
+ *
345
352
* This function parses a Borger.dk-ArticleDescription and extracts all
346
353
* the field values we want for our list of titles (for autocompletion etc)
347
354
*/
0 commit comments