Skip to content

Commit 3309861

Browse files
author
Yani Xu
committed
Add code that import bullet/bullet_attach content
1 parent 434e5a6 commit 3309861

File tree

1 file changed

+24
-16
lines changed

1 file changed

+24
-16
lines changed

plugins/mm/os2web_edoc_esdh_mm.inc

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -199,10 +199,12 @@ function _os2web_edoc_esdh_mm_import_meeting_agenda_item($meeting, $xml) {
199199
$xml_item['number'] = (int) $xml->AgendaItemNumber;
200200
$xml_item['pdf'] = (string) $xml->PDFDocument;
201201
$xml_item_document = $xml->Document;
202+
$xml_item_bullet = $xml_item_document->AgendaItems;
203+
$xml_item_fulltext = (string) $xml->FullText;
202204
$xml_item['name'] = (string) $xml_item_document->NeutralTitle;
203205
$xml_item['document_type'] = (string) $xml_item_document->PublishingType;
204-
205-
#error_log(print_r($meeting, 1));
206+
// error_log(print_r("FullText => ".$xml_item_bullet, 1));
207+
// error_log(print_r($meeting, 1));
206208
$item = array(
207209
'id' => $xml_item['number'],
208210
'title' => 'Punkt ' . $xml_item['number'] . ' ' . $xml_item['name'],
@@ -213,29 +215,28 @@ function _os2web_edoc_esdh_mm_import_meeting_agenda_item($meeting, $xml) {
213215
'uri' => implode('/', array(
214216
trim($meeting['uri'], "/"),
215217
$xml_item['pdf'])),
216-
'title' => $xml_item['name'],
218+
// 'title' => $xml_item['name'],
219+
// 'body' => $xml_item_fulltext,
217220
),
218221
);
219222

220223
// Deny closed content.
221224
if ($item['access'] === 'SKAL PUBLICERES') {
222225
// Process attachments.
223-
// foreach ($xml->xpath("table[@name='bullet']") as $bullet_xml) {
224-
// if (($bullet = _os2web_edoc_esdh_import_bullet($info, $bullet_xml)) !== FALSE) {
225-
// if (is_int($bullet['sort']) && $bullet['sort'] > 0) {
226-
// $item['bullets'][$bullet['sort'] - 1] = $bullet;
227-
// }
228-
// else {
229-
// $item['bullets'][] = $bullet;
230-
// }
231-
// }
232-
// }
226+
foreach ($xml_item_bullet->AgendaItem as $bullet_xml) {
227+
228+
$item['bullets'][] = array(
229+
'title' => (string) $bullet_xml->Name,
230+
'body' => $xml_item_fulltext,
231+
);
232+
#error_log(print_r("FullText => ".$item['bullets'], 1));
233+
}
233234
// Process attachments.
234235
#error_log(print_r($xml_item_document->Attachments, 1 ));
235236
foreach ($xml_item_document->Attachments as $enclosures) {
236-
#error_log(print_r($enclosure, 1 ));
237+
#error_log(print_r($encliosure, 1 ));
237238
foreach ($enclosures->Attachment as $enclosure) {
238-
#error_log(print_r($enclosure, 1 ));
239+
// error_log(print_r("Fulltext -- > : ".$enclosure->FullText, 1 ));
239240
$enclosure_item['filename_in'] = (string) $enclosure->PDFDocument;
240241
$enclosure_item['access'] = (string) $enclosure->PublishingType;
241242
if (strlen($enclosure_item['filename_in']) > 0 && $enclosure_item['access'] === 'SKAL PUBLICERES') {
@@ -246,8 +247,15 @@ function _os2web_edoc_esdh_mm_import_meeting_agenda_item($meeting, $xml) {
246247
'title' => trim((string) $enclosure->NeutralTitle),
247248
'access' => TRUE,
248249
);
250+
/* $item['bullets'][] = array(
251+
'title' => trim((string) $enclosure->NeutralTitle),
252+
'body' => $enclosure->FullText,
253+
254+
);*/
255+
// error_log(print_r(" Bullet 0 => ".$item['bullets'][0]['title'], 1));
249256
}
250257
}
258+
251259
}
252260
}
253261
#error_log(print_r($item, 1));
@@ -302,7 +310,7 @@ function _os2web_edoc_esdh_mm_order_addenums($drush = FALSE) {
302310
return;
303311
}
304312
$nodes = $nodes_result['node'];
305-
error_log(print_r($nodes, 1));
313+
// error_log(print_r($nodes, 1));
306314
// Load necessary fields into the node object.
307315
$fields = field_info_instances('node', 'meeting');
308316
field_attach_load('node', $nodes, FIELD_LOAD_CURRENT, array('field_id' => $fields['field_os2web_meetings_addendum']['field_id']));

0 commit comments

Comments
 (0)